@histoire/vue 1.0.0-beta.2 → 1.0.0-beta.3

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.
@@ -12,6 +12,11 @@ export declare const HistoireEmbed: import("vue").DefineComponent<import("vue").
12
12
  type: PropType<readonly HistoireEmbedPanel[]>;
13
13
  default: () => string[];
14
14
  };
15
+ /** Gutter in CSS pixels around the variant, replacing the story and project padding. */
16
+ padding: {
17
+ type: NumberConstructor;
18
+ default: undefined;
19
+ };
15
20
  }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
16
21
  [key: string]: any;
17
22
  }>[] | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
@@ -27,10 +32,16 @@ export declare const HistoireEmbed: import("vue").DefineComponent<import("vue").
27
32
  type: PropType<readonly HistoireEmbedPanel[]>;
28
33
  default: () => string[];
29
34
  };
35
+ /** Gutter in CSS pixels around the variant, replacing the story and project padding. */
36
+ padding: {
37
+ type: NumberConstructor;
38
+ default: undefined;
39
+ };
30
40
  }>> & Readonly<{
31
41
  onError?: ((...args: any[]) => any) | undefined;
32
42
  onReady?: ((...args: any[]) => any) | undefined;
33
43
  }>, {
34
44
  panels: readonly ("controls" | "docs" | "events" | "source")[];
45
+ padding: number;
35
46
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
36
47
  //# sourceMappingURL=HistoireEmbed.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"HistoireEmbed.d.ts","sourceRoot":"","sources":["../../../src/components/embed/HistoireEmbed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AAUnC,yFAAyF;AACzF,eAAO,MAAM,aAAa;IAGtB,8EAA8E;;cACrD,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC;;;IACtD,qDAAqD;;QAC3C,IAAI,EAAW,QAAQ,CAAC,SAAS,kBAAkB,EAAE,CAAC;QAAE,OAAO;;;;;;;IAHzE,8EAA8E;;;;;IAE9E,qDAAqD;;;;;;;;;;4EA6DvD,CAAA"}
1
+ {"version":3,"file":"HistoireEmbed.d.ts","sourceRoot":"","sources":["../../../src/components/embed/HistoireEmbed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AAUnC,yFAAyF;AACzF,eAAO,MAAM,aAAa;IAGtB,8EAA8E;;cACrD,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC;;;IACtD,qDAAqD;;QAC3C,IAAI,EAAW,QAAQ,CAAC,SAAS,kBAAkB,EAAE,CAAC;QAAE,OAAO;;IACzE,wFAAwF;;QAC7E,IAAI;QAAU,OAAO;;;;;;;IALhC,8EAA8E;;;;;IAE9E,qDAAqD;;;;;IAErD,wFAAwF;;;;;;;;;;;4EA6D1F,CAAA"}
@@ -14,6 +14,8 @@ export const HistoireEmbed = defineComponent({
14
14
  scope: { type: String, required: true },
15
15
  /** Enabled panels; empty array gives canvas only. */
16
16
  panels: { type: Array, default: () => ['controls'] },
17
+ /** Gutter in CSS pixels around the variant, replacing the story and project padding. */
18
+ padding: { type: Number, default: undefined },
17
19
  },
18
20
  emits: ['ready', 'error'],
19
21
  setup(props, { emit, slots }) {
@@ -72,7 +74,7 @@ export const HistoireEmbed = defineComponent({
72
74
  props.scope === 'story' ? h(HstSelect, { 'layout': 'inline', 'aria-label': 'Variant', 'modelValue': selected, 'options': story.value.variants.map(variant => ({ value: variant.id, label: variant.title })), 'onUpdate:modelValue': selectVariant }) : null,
73
75
  ]),
74
76
  h('div', { class: 'histoire-embed-workspace' }, [
75
- h('main', { 'ref': canvas, 'class': 'histoire-embed-canvas', 'aria-label': 'Canvas' }, [h(HistoirePreview, { onReady: () => active && emit('ready'), onError: error }, slots.canvas)]),
77
+ h('main', { 'ref': canvas, 'class': 'histoire-embed-canvas', 'aria-label': 'Canvas' }, [h(HistoirePreview, { padding: props.padding, onReady: () => active && emit('ready'), onError: error }, slots.canvas)]),
76
78
  panels.value.length ? h(EmbedPanels, { panels: panels.value, onError: error }) : null,
77
79
  ]),
78
80
  ]);
@@ -1,11 +1,23 @@
1
1
  /** Isolated single preview using nearest provider's explicit session. */
2
- export declare const HistoirePreview: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
2
+ export declare const HistoirePreview: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
3
+ padding: {
4
+ type: NumberConstructor;
5
+ default: undefined;
6
+ };
7
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
3
8
  [key: string]: any;
4
9
  }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
10
  ready: () => true;
6
11
  error: (_error: unknown) => true;
7
- }, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
12
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
13
+ padding: {
14
+ type: NumberConstructor;
15
+ default: undefined;
16
+ };
17
+ }>> & Readonly<{
8
18
  onError?: ((_error: unknown) => any) | undefined;
9
19
  onReady?: (() => any) | undefined;
10
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
20
+ }>, {
21
+ padding: number;
22
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
11
23
  //# sourceMappingURL=HistoirePreview.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"HistoirePreview.d.ts","sourceRoot":"","sources":["../../../src/components/preview/HistoirePreview.ts"],"names":[],"mappings":"AAEA,yEAAyE;AACzE,eAAO,MAAM,eAAe;;;;;;;;iFAAsD,CAAA"}
1
+ {"version":3,"file":"HistoirePreview.d.ts","sourceRoot":"","sources":["../../../src/components/preview/HistoirePreview.ts"],"names":[],"mappings":"AAEA,yEAAyE;AACzE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;4EAAsD,CAAA"}
@@ -1,13 +1,27 @@
1
1
  /** Build native primary wrapper around SDK-owned source runtime; no host story imports. */
2
- export declare function createHistoirePrimary(name: string, surface: 'preview'): import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
2
+ export declare function createHistoirePrimary(name: string, surface: 'preview'): import("vue").DefineComponent<import("vue").ExtractPropTypes<{
3
+ /** Gutter in CSS pixels around the variant, replacing the story and project padding. */
4
+ padding: {
5
+ type: NumberConstructor;
6
+ default: undefined;
7
+ };
8
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
3
9
  [key: string]: any;
4
10
  }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
11
  /** Fires after source runtime readiness, including explicit empty-book readiness. */
6
12
  ready: () => true;
7
13
  /** Typed source/runtime or primary ownership failure. */
8
14
  error: (_error: unknown) => true;
9
- }, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
15
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
16
+ /** Gutter in CSS pixels around the variant, replacing the story and project padding. */
17
+ padding: {
18
+ type: NumberConstructor;
19
+ default: undefined;
20
+ };
21
+ }>> & Readonly<{
10
22
  onError?: ((_error: unknown) => any) | undefined;
11
23
  onReady?: (() => any) | undefined;
12
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
24
+ }>, {
25
+ padding: number;
26
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
13
27
  //# sourceMappingURL=surface.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"surface.d.ts","sourceRoot":"","sources":["../../../src/components/preview/surface.ts"],"names":[],"mappings":"AAQA,2FAA2F;AAC3F,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS;;;IAKhE,qFAAqF;;IAErF,yDAAyD;oBACzC,OAAO;;;;kFAoG5B"}
1
+ {"version":3,"file":"surface.d.ts","sourceRoot":"","sources":["../../../src/components/preview/surface.ts"],"names":[],"mappings":"AAQA,2FAA2F;AAC3F,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS;IAKhE,wFAAwF;;QAC7E,IAAI;QAAU,OAAO;;;;;IAGhC,qFAAqF;;IAErF,yDAAyD;oBACzC,OAAO;;IAPvB,wFAAwF;;;;;;;;;;6EA2G7F"}
@@ -9,13 +9,17 @@ export function createHistoirePrimary(name, surface) {
9
9
  return defineComponent({
10
10
  name,
11
11
  inheritAttrs: false,
12
+ props: {
13
+ /** Gutter in CSS pixels around the variant, replacing the story and project padding. */
14
+ padding: { type: Number, default: undefined },
15
+ },
12
16
  emits: {
13
17
  /** Fires after source runtime readiness, including explicit empty-book readiness. */
14
18
  ready: () => true,
15
19
  /** Typed source/runtime or primary ownership failure. */
16
20
  error: (_error) => true,
17
21
  },
18
- setup(_props, { attrs, slots, emit, expose }) {
22
+ setup(props, { attrs, slots, emit, expose }) {
19
23
  const context = useHistoireContext();
20
24
  const session = context.session;
21
25
  const initial = session.getSnapshot();
@@ -76,7 +80,7 @@ export function createHistoirePrimary(name, surface) {
76
80
  if (removed || !container.value)
77
81
  return;
78
82
  try {
79
- mount = session.mount(container.value, { surface });
83
+ mount = session.mount(container.value, { surface, ...(props.padding === undefined ? {} : { padding: props.padding }) });
80
84
  stopReadiness = session.subscribe(synchronizeReadiness);
81
85
  stopFocus = subscribeHistoireMountEvents(mount, (event) => {
82
86
  if (event.event !== 'focus.changed')
package/dist/controls.css CHANGED
@@ -20,7 +20,7 @@
20
20
  :where(.histoire-provider) .histoire-preset-dropdown { flex: none; }
21
21
  :where(.histoire-provider) .histoire-preset-trigger { --histoire-icon-button-size: 32px; cursor: pointer; }
22
22
  :where(.histoire-provider) :is(.histoire-preset-menu, .histoire-preset-form) { width: 200px; max-width: 100%; padding: 4px; }
23
- :where(.histoire-provider) .histoire-preset-menu { display: flex; flex-direction: column; }
23
+ :where(.histoire-provider) .histoire-preset-menu { display: flex; flex-direction: column; row-gap: 1px; }
24
24
  :where(.histoire-provider) .histoire-preset-menu :where(button) { width: 100%; justify-content: flex-start; text-align: left; }
25
25
  :where(.histoire-provider) .histoire-preset-form { padding: 10px; }
26
26
  :where(.histoire-provider) .histoire-preset-form-actions { display: flex; justify-content: flex-end; gap: 4px; margin-top: 6px; }
package/dist/tests.css CHANGED
@@ -18,7 +18,7 @@
18
18
  :where(.histoire-provider) .histoire-tests-run:not(:disabled){color:var(--histoire-tests-passed)}
19
19
  :where(.histoire-provider) .histoire-tests-run-trigger{--histoire-icon-button-size:30px;border-inline-start:1px solid var(--histoire-control-resolved-border,var(--histoire-border))!important;color:var(--histoire-muted)}
20
20
  :where(.histoire-provider) .histoire-tests-cancel{color:var(--histoire-tests-failed-text)}
21
- :where(.histoire-provider) .histoire-tests-run-menu{min-width:156px}
21
+ :where(.histoire-provider) .histoire-tests-run-menu{display:flex;flex-direction:column;row-gap:1px;min-width:156px}
22
22
  :where(.histoire-provider) .histoire-tests-run-menu .histoire-button{width:100%;justify-content:flex-start;padding:6px 10px;text-align:start}
23
23
  :where(.histoire-provider) .histoire-tests-status{flex:1;min-width:0;overflow:hidden;color:var(--histoire-muted);font-size:12px;font-variant-numeric:tabular-nums;text-align:end;white-space:nowrap;text-overflow:ellipsis}
24
24
  :where(.histoire-provider) .histoire-tests-status [data-state="passed"]{color:var(--histoire-tests-passed)}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@histoire/vue",
3
3
  "type": "module",
4
- "version": "1.0.0-beta.2",
4
+ "version": "1.0.0-beta.3",
5
5
  "description": "Native Vue components for Histoire sessions",
6
6
  "license": "MIT",
7
7
  "publishConfig": {
@@ -36,10 +36,10 @@
36
36
  "floating-vue": "5.2.2",
37
37
  "shiki": "^3.0.0",
38
38
  "vue-virtual-scroller": "^3.0.5",
39
- "@histoire/controls": "^1.0.0-beta.2",
40
- "@histoire/plugin-kit": "^1.0.0-beta.2",
41
- "@histoire/protocol": "^1.0.0-beta.2",
42
- "@histoire/sdk": "^1.0.0-beta.2"
39
+ "@histoire/controls": "^1.0.0-beta.3",
40
+ "@histoire/plugin-kit": "^1.0.0-beta.3",
41
+ "@histoire/protocol": "^1.0.0-beta.3",
42
+ "@histoire/sdk": "^1.0.0-beta.3"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@typescript/native": "npm:typescript@7.0.2",
@@ -51,7 +51,7 @@
51
51
  "vitest": "5.1.1",
52
52
  "vue": "^3.5.26",
53
53
  "vue-router": "^4.5.0",
54
- "@histoire/shared": "^1.0.0-beta.2"
54
+ "@histoire/shared": "^1.0.0-beta.3"
55
55
  },
56
56
  "scripts": {
57
57
  "build": "rimraf dist && tsc && node scripts/copy-styles.mjs",