@abcnews/components-builder 0.0.16 → 0.0.17

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.
@@ -10,6 +10,7 @@
10
10
  tags: ["autodocs"],
11
11
  argTypes: {},
12
12
  args: {},
13
+ // @ts-expect-error This is apparently a bug https://github.com/storybookjs/storybook/issues/29951
13
14
  decorators: [() => BuilderStyleRoot],
14
15
  });
15
16
  </script>
@@ -1,6 +1,7 @@
1
1
  <script module>
2
2
  import { defineMeta } from "@storybook/addon-svelte-csf";
3
3
  import BuilderStyleRoot from "./BuilderStyleRoot.svelte";
4
+ import { Trash } from "svelte-bootstrap-icons";
4
5
 
5
6
  // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
6
7
  const { Story } = defineMeta({
@@ -86,22 +87,7 @@
86
87
  <fieldset>
87
88
  <legend>
88
89
  <button class="btn-icon" title="Clear focuses" aria-label="Clear focuses">
89
- <svg
90
- xmlns="http://www.w3.org/2000/svg"
91
- width="16"
92
- height="16"
93
- fill="currentColor"
94
- class="bi bi-trash"
95
- viewBox="0 0 16 16"
96
- role="img"
97
- >
98
- <path
99
- d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z"
100
- />
101
- <path
102
- d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4zM2.5 3h11V2h-11z"
103
- />
104
- </svg>
90
+ <Trash width="16" height="16" />
105
91
  </button>
106
92
  With button
107
93
  </legend>
@@ -121,22 +107,7 @@
121
107
  title="Clear focuses"
122
108
  aria-label="Clear focuses"
123
109
  >
124
- <svg
125
- xmlns="http://www.w3.org/2000/svg"
126
- width="16"
127
- height="16"
128
- fill="currentColor"
129
- class="bi bi-trash"
130
- viewBox="0 0 16 16"
131
- role="img"
132
- >
133
- <path
134
- d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z"
135
- />
136
- <path
137
- d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4zM2.5 3h11V2h-11z"
138
- />
139
- </svg>
110
+ <Trash width="16" height="16" />
140
111
  </button>
141
112
  {/each}
142
113
  </div>
@@ -10,6 +10,7 @@
10
10
  tags: ["autodocs"],
11
11
  argTypes: {},
12
12
  args: {},
13
+ // @ts-expect-error This is apparently a bug https://github.com/storybookjs/storybook/issues/29951
13
14
  decorators: [() => BuilderStyleRoot],
14
15
  });
15
16
  </script>
@@ -10,6 +10,7 @@
10
10
  tags: ["autodocs"],
11
11
  argTypes: {},
12
12
  args: {},
13
+ // @ts-expect-error This is apparently a bug https://github.com/storybookjs/storybook/issues/29951
13
14
  decorators: [() => BuilderStyleRoot],
14
15
  });
15
16
  </script>
@@ -0,0 +1,36 @@
1
+ <script module>
2
+ import { defineMeta } from "@storybook/addon-svelte-csf";
3
+ import MarkerAdmin from "./MarkerAdmin.svelte";
4
+ import BuilderStyleRoot from "../BuilderStyleRoot/BuilderStyleRoot.svelte";
5
+
6
+ const { Story } = defineMeta({
7
+ title: "Components/MarkerAdmin",
8
+ component: MarkerAdmin,
9
+ tags: ["autodocs"],
10
+ decorators: [() => BuilderStyleRoot],
11
+ argTypes: {
12
+ projectName: { control: "text" },
13
+ },
14
+ args: {
15
+ projectName: "storybook-test",
16
+ prefixes: {
17
+ "Scrolly mark": "#mark",
18
+ "Scrolly opener": "#scrollytellerNAMEscrolly1",
19
+ "Standalone graphic": "#graphic",
20
+ },
21
+ defaultMarkerName: () => "My New Marker",
22
+ },
23
+ });
24
+ </script>
25
+
26
+ <Story name="Primary" />
27
+
28
+ <Story
29
+ name="Custom Prefixes"
30
+ args={{
31
+ prefixes: {
32
+ "Custom Prefix": "#custom",
33
+ "Another One": "#another",
34
+ },
35
+ }}
36
+ />
@@ -0,0 +1,27 @@
1
+ export default MarkerAdmin;
2
+ type MarkerAdmin = SvelteComponent<{
3
+ [x: string]: never;
4
+ }, {
5
+ [evt: string]: CustomEvent<any>;
6
+ }, {}> & {
7
+ $$bindings?: string | undefined;
8
+ };
9
+ declare const MarkerAdmin: $$__sveltets_2_IsomorphicComponent<{
10
+ [x: string]: never;
11
+ }, {
12
+ [evt: string]: CustomEvent<any>;
13
+ }, {}, {}, string>;
14
+ import MarkerAdmin from "./MarkerAdmin.svelte";
15
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
16
+ new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
17
+ $$bindings?: Bindings;
18
+ } & Exports;
19
+ (internal: unknown, props: {
20
+ $$events?: Events;
21
+ $$slots?: Slots;
22
+ }): Exports & {
23
+ $set?: any;
24
+ $on?: any;
25
+ };
26
+ z_$$bindings?: Bindings;
27
+ }
@@ -1,16 +1,23 @@
1
1
  <script lang="ts">
2
+ import {
3
+ defaultMarkerNameDefault,
4
+ prefixesDefault,
5
+ } from "../shared-defaults.js";
2
6
  import { onMount, untrack } from "svelte";
3
7
  import { slide } from "svelte/transition";
8
+ import {
9
+ Floppy,
10
+ Copy,
11
+ Clipboard,
12
+ Trash,
13
+ ArrowCounterclockwise,
14
+ } from "svelte-bootstrap-icons";
4
15
 
5
16
  let {
6
17
  /** Unique project name used in localStorage (e.g. "elections-federal2025-lower-house")*/
7
18
  projectName = "dev",
8
- defaultMarkerName = () => "",
9
- prefixes = {
10
- "Scrolly mark": "#mark",
11
- "Scrolly opener": "#scrollytellerNAMEscrolly1",
12
- "Standalone graphic": "#graphic",
13
- },
19
+ defaultMarkerName = defaultMarkerNameDefault,
20
+ prefixes = prefixesDefault,
14
21
  } = $props();
15
22
 
16
23
  type Marker = {
@@ -44,6 +51,7 @@
44
51
  return;
45
52
  }
46
53
  try {
54
+ console.log("writing localStorage");
47
55
  localStorage[localStorageKey] = JSON.stringify({
48
56
  version: version,
49
57
  lastUpdated: new Date().toISOString(),
@@ -107,93 +115,23 @@
107
115
  </script>
108
116
 
109
117
  {#snippet saveIcon()}
110
- <svg
111
- xmlns="http://www.w3.org/2000/svg"
112
- width="16"
113
- height="16"
114
- fill="currentColor"
115
- class="bi bi-floppy"
116
- viewBox="0 0 16 16"
117
- >
118
- <title>Save</title>
119
- <path d="M11 2H9v3h2z" />
120
- <path
121
- d="M1.5 0h11.586a1.5 1.5 0 0 1 1.06.44l1.415 1.414A1.5 1.5 0 0 1 16 2.914V14.5a1.5 1.5 0 0 1-1.5 1.5h-13A1.5 1.5 0 0 1 0 14.5v-13A1.5 1.5 0 0 1 1.5 0M1 1.5v13a.5.5 0 0 0 .5.5H2v-4.5A1.5 1.5 0 0 1 3.5 9h9a1.5 1.5 0 0 1 1.5 1.5V15h.5a.5.5 0 0 0 .5-.5V2.914a.5.5 0 0 0-.146-.353l-1.415-1.415A.5.5 0 0 0 13.086 1H13v4.5A1.5 1.5 0 0 1 11.5 7h-7A1.5 1.5 0 0 1 3 5.5V1H1.5a.5.5 0 0 0-.5.5m3 4a.5.5 0 0 0 .5.5h7a.5.5 0 0 0 .5-.5V1H4zM3 15h10v-4.5a.5.5 0 0 0-.5-.5h-9a.5.5 0 0 0-.5.5z"
122
- />
123
- </svg>
118
+ <Floppy width="16" height="16" />
124
119
  {/snippet}
125
120
 
126
121
  {#snippet copyIcon()}
127
- <svg
128
- xmlns="http://www.w3.org/2000/svg"
129
- width="16"
130
- height="16"
131
- fill="currentColor"
132
- class="bi bi-copy"
133
- viewBox="0 0 16 16"
134
- >
135
- <title>Copy to clipboard</title>
136
- <path
137
- fill-rule="evenodd"
138
- d="M4 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2zm2-1a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1zM2 5a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-1h1v1a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h1v1z"
139
- />
140
- </svg>
122
+ <Copy width="16" height="16" />
141
123
  {/snippet}
142
124
 
143
125
  {#snippet pasteIcon()}
144
- <svg
145
- xmlns="http://www.w3.org/2000/svg"
146
- width="16"
147
- height="16"
148
- fill="currentColor"
149
- class="bi bi-clipboard"
150
- viewBox="0 0 16 16"
151
- >
152
- <title>Paste marker from clipboard</title>
153
- <path
154
- d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1z"
155
- />
156
- <path
157
- d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0z"
158
- />
159
- </svg>
126
+ <Clipboard width="16" height="16" />
160
127
  {/snippet}
161
128
 
162
129
  {#snippet deleteIcon()}
163
- <svg
164
- xmlns="http://www.w3.org/2000/svg"
165
- width="16"
166
- height="16"
167
- fill="currentColor"
168
- class="bi bi-trash"
169
- viewBox="0 0 16 16"
170
- >
171
- <path
172
- d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z"
173
- />
174
- <path
175
- d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4zM2.5 3h11V2h-11z"
176
- />
177
- </svg>
130
+ <Trash width="16" height="16" />
178
131
  {/snippet}
179
132
 
180
133
  {#snippet undeleteIcon()}
181
- <svg
182
- xmlns="http://www.w3.org/2000/svg"
183
- width="16"
184
- height="16"
185
- fill="currentColor"
186
- class="bi bi-arrow-counterclockwise"
187
- viewBox="0 0 16 16"
188
- >
189
- <path
190
- fill-rule="evenodd"
191
- d="M8 3a5 5 0 1 1-4.546 2.914.5.5 0 0 0-.908-.417A6 6 0 1 0 8 2z"
192
- />
193
- <path
194
- d="M8 4.466V.534a.25.25 0 0 0-.41-.192L5.23 2.308a.25.25 0 0 0 0 .384l2.36 1.966A.25.25 0 0 0 8 4.466"
195
- />
196
- </svg>
134
+ <ArrowCounterclockwise width="16" height="16" />
197
135
  {/snippet}
198
136
 
199
137
  <div class="toolbar">
@@ -317,9 +255,25 @@
317
255
  {/if}
318
256
  </td>
319
257
  <td class="btn-group">
258
+ {#if !marker.deleted}
259
+ <button
260
+ onclick={(e) => {
261
+ e.preventDefault();
262
+ e.stopPropagation();
263
+ if (confirm(`Overwrite '${marker.name}'?`)) {
264
+ marker.hash = window.location.hash.slice(1);
265
+ }
266
+ }}
267
+ title="Overwrite snapshot with current state"
268
+ style:height="32px"
269
+ >
270
+ {@render saveIcon()}
271
+ </button>
272
+ {/if}
320
273
  <button
321
274
  onclick={(e) => {
322
275
  e.preventDefault();
276
+ e.stopPropagation();
323
277
  const newMarkers = [...markers];
324
278
  const marker = newMarkers[index];
325
279
  if (marker.deleted) {
@@ -1,7 +1,8 @@
1
+ import { defaultMarkerNameDefault, prefixesDefault } from "../shared-defaults.js";
1
2
  declare const MarkerAdmin: import("svelte").Component<{
2
3
  projectName?: string;
3
- defaultMarkerName?: Function;
4
- prefixes?: Record<string, any>;
4
+ defaultMarkerName?: typeof defaultMarkerNameDefault;
5
+ prefixes?: typeof prefixesDefault;
5
6
  }, {}, "">;
6
7
  type MarkerAdmin = ReturnType<typeof MarkerAdmin>;
7
8
  export default MarkerAdmin;
@@ -1,32 +1,33 @@
1
1
  <script module>
2
- import { defineMeta } from '@storybook/addon-svelte-csf';
3
- import Modal from './Modal.svelte';
4
- import BuilderStyleRoot from '../BuilderStyleRoot/BuilderStyleRoot.svelte';
2
+ import { defineMeta } from "@storybook/addon-svelte-csf";
3
+ import Modal from "./Modal.svelte";
4
+ import BuilderStyleRoot from "../BuilderStyleRoot/BuilderStyleRoot.svelte";
5
5
 
6
- // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
7
- const { Story } = defineMeta({
8
- title: 'Example/Modal',
9
- component: Modal,
10
- tags: ['autodocs'],
11
- argTypes: {},
12
- args: {},
13
- decorators: [() => BuilderStyleRoot]
14
- });
6
+ // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
7
+ const { Story } = defineMeta({
8
+ title: "Example/Modal",
9
+ component: Modal,
10
+ tags: ["autodocs"],
11
+ argTypes: {},
12
+ args: {},
13
+ // @ts-expect-error This is apparently a bug https://github.com/storybookjs/storybook/issues/29951
14
+ decorators: [() => BuilderStyleRoot],
15
+ });
15
16
  </script>
16
17
 
17
18
  {#snippet children()}
18
- Hello this is a modal
19
+ Hello this is a modal
19
20
  {/snippet}
20
21
  {#snippet footerChildren()}
21
- <button>Ok!</button>
22
+ <button>Ok!</button>
22
23
  {/snippet}
23
24
 
24
25
  <!-- More on writing stories with args: https://storybook.js.org/docs/writing-stories/args -->
25
26
  <Story
26
- name="Primary"
27
- args={{
28
- children,
29
- footerChildren,
30
- title: 'Example modal'
31
- }}
27
+ name="Primary"
28
+ args={{
29
+ children,
30
+ footerChildren,
31
+ title: "Example modal",
32
+ }}
32
33
  />
@@ -11,7 +11,7 @@ declare const Modal: $$__sveltets_2_IsomorphicComponent<{
11
11
  }, {
12
12
  [evt: string]: CustomEvent<any>;
13
13
  }, {}, {}, string>;
14
- import Modal from './Modal.svelte';
14
+ import Modal from "./Modal.svelte";
15
15
  interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
16
16
  new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
17
17
  $$bindings?: Bindings;
@@ -10,6 +10,7 @@
10
10
  tags: ["autodocs"],
11
11
  argTypes: {},
12
12
  args: {},
13
+ // @ts-expect-error This is apparently a bug https://github.com/storybookjs/storybook/issues/29951
13
14
  decorators: [() => BuilderStyleRoot],
14
15
  });
15
16
  </script>
@@ -20,7 +21,5 @@
20
21
  args={{
21
22
  // Prefixes to look for in the pasted document
22
23
  prefixes: { Marker: "#mark" },
23
- // Do something with the markers before screenshotting (e.g. turn off animations)
24
- parseMarker: (markerString) => "markNewMarkerString",
25
24
  }}
26
25
  />
@@ -1,26 +1,39 @@
1
- <script>
1
+ <script lang="ts">
2
2
  import { untrack } from "svelte";
3
3
  import JSZip from "jszip";
4
- import eachLimit from "async/eachLimit";
4
+ import { eachLimit } from "async";
5
5
  import Modal from "../Modal/Modal.svelte";
6
- import saveAs from "./saveAs";
6
+ import saveAs from "./saveAs.js";
7
+ import {
8
+ defaultMarkerNameDefault,
9
+ prefixesDefault,
10
+ } from "../shared-defaults.js";
11
+
12
+ interface Props {
13
+ defaultMarkerName: DefaultMarkerNameFunction;
14
+ prefixes: MarkerPrefixes;
15
+ onMarker: (marker: string) => string;
16
+ iframeUrl: string;
17
+ }
18
+
19
+ type PreviewConfig = { name: string; marker: string; markerString: string };
7
20
 
8
21
  const GENERATOR_URL = "https://fallback-automations-yknow.kyd.au/api";
9
22
  const GENERATOR_MAX_PARALLEL = 3;
10
23
  const GENERATOR_WIDTH = "1000";
11
24
 
12
25
  let {
13
- defaultMarkerName = () => "Marker",
14
- prefixes = {},
26
+ defaultMarkerName = defaultMarkerNameDefault,
27
+ prefixes = prefixesDefault,
15
28
  // Optional function to process markers
16
- onMarker = (str) => str,
29
+ onMarker = (str: string) => str,
17
30
  iframeUrl = "",
18
- } = $props();
31
+ }: Props = $props();
19
32
 
20
33
  // closed => pasting => preview => generate => done
21
34
  let status = $state("closed");
22
- let pastedState = $state();
23
- let preview = $state([]);
35
+ let pastedState: string = $state("");
36
+ let preview: PreviewConfig[] = $state([]);
24
37
  let progress = $state(0);
25
38
  let error = $state("");
26
39
 
@@ -50,9 +63,9 @@
50
63
  // pass through schema
51
64
  const parsedMarkers = await Promise.all(uniqueMarkers.map(onMarker));
52
65
 
53
- // generate a friendly name & reencode markers with hexFlip="none"
66
+ // generate a friendly name
54
67
  preview = await Promise.all(
55
- parsedMarkers.map(async (marker) => ({
68
+ parsedMarkers.map(async (marker: string) => ({
56
69
  name: defaultMarkerName(marker),
57
70
  marker,
58
71
  markerString: "#" + marker,
@@ -61,26 +74,37 @@
61
74
  })();
62
75
  });
63
76
 
64
- function doFetch(generatorUrl) {
65
- return fetch(generatorUrl).then((response) => {
66
- if (response.status !== 200) {
67
- return null;
68
- }
69
- return response.blob();
70
- });
77
+ async function doFetch(generatorUrl: string) {
78
+ const response = await fetch(generatorUrl);
79
+ if (response.status !== 200) {
80
+ return null;
81
+ }
82
+ return response.blob();
71
83
  }
72
84
 
73
- async function sleep(seconds) {
85
+ async function sleep(seconds: number): Promise<void> {
74
86
  return new Promise((resolve) => setTimeout(resolve, seconds));
75
87
  }
76
88
 
77
- async function createScreenshots({ preview }) {
89
+ async function retry<T extends () => Promise<any>>(
90
+ fn: T,
91
+ attempt: number = 0,
92
+ ): Promise<Awaited<ReturnType<T>>> {
93
+ let result = await fn();
94
+ if (!result && attempt < 5) {
95
+ await sleep(1000 * 2 * attempt);
96
+ return retry(fn, attempt + 1);
97
+ }
98
+ return result;
99
+ }
100
+
101
+ async function createScreenshots({ preview }: { preview: PreviewConfig[] }) {
78
102
  const zip = new JSZip();
79
103
  let completed = 0;
80
104
  // Put a little bit in the bar at the start so it's clear what it is.
81
105
  progress = 0.5 / preview.length;
82
106
  error = "";
83
- const imageBlobs = [];
107
+ const imageBlobs: (Blob | null)[] = [];
84
108
  await eachLimit(
85
109
  preview,
86
110
  GENERATOR_MAX_PARALLEL,
@@ -95,18 +119,8 @@
95
119
  }).toString(),
96
120
  ].join("?");
97
121
 
98
- let blob;
99
- // retry. It fails sometimes.
100
- for (let retry = 0; retry < 5; retry++) {
101
- console.log(thisIframeUrl, "attempt ", retry);
102
- blob = await doFetch(generatorUrl);
103
- if (!blob) {
104
- await sleep(1000 * 2 * retry);
105
- }
106
- if (blob) {
107
- break;
108
- }
109
- }
122
+ const blob = await retry(() => doFetch(generatorUrl));
123
+
110
124
  completed += 1;
111
125
  progress = completed / preview.length;
112
126
 
@@ -115,7 +129,7 @@
115
129
  },
116
130
  );
117
131
 
118
- const errors = [];
132
+ const errors: string[] = [];
119
133
  imageBlobs.forEach((blob, index) => {
120
134
  const filename = `${String(index).padStart(3, "0")}-${preview[index].name}.png`;
121
135
  if (blob) {
@@ -1,17 +1,9 @@
1
+ interface Props {
2
+ defaultMarkerName: DefaultMarkerNameFunction;
3
+ prefixes: MarkerPrefixes;
4
+ onMarker: (marker: string) => string;
5
+ iframeUrl: string;
6
+ }
7
+ declare const ScreenshotTool: import("svelte").Component<Props, {}, "">;
8
+ type ScreenshotTool = ReturnType<typeof ScreenshotTool>;
1
9
  export default ScreenshotTool;
2
- type ScreenshotTool = {
3
- $on?(type: string, callback: (e: any) => void): () => void;
4
- $set?(props: Partial<$$ComponentProps>): void;
5
- };
6
- declare const ScreenshotTool: import("svelte").Component<{
7
- defaultMarkerName?: Function;
8
- prefixes?: Record<string, any>;
9
- onMarker?: Function;
10
- iframeUrl?: string;
11
- }, {}, "">;
12
- type $$ComponentProps = {
13
- defaultMarkerName?: Function;
14
- prefixes?: Record<string, any>;
15
- onMarker?: Function;
16
- iframeUrl?: string;
17
- };
@@ -10,6 +10,7 @@
10
10
  tags: ["autodocs"],
11
11
  argTypes: {},
12
12
  args: {},
13
+ // @ts-expect-error This is apparently a bug https://github.com/storybookjs/storybook/issues/29951
13
14
  decorators: [() => BuilderStyleRoot],
14
15
  });
15
16
  </script>
@@ -10,6 +10,7 @@
10
10
  tags: ["autodocs"],
11
11
  argTypes: {},
12
12
  args: {},
13
+ // @ts-expect-error This is apparently a bug https://github.com/storybookjs/storybook/issues/29951
13
14
  decorators: [() => BuilderStyleRoot],
14
15
  });
15
16
  </script>
@@ -0,0 +1,2 @@
1
+ export declare const defaultMarkerNameDefault: () => string;
2
+ export declare const prefixesDefault: MarkerPrefixes;
@@ -0,0 +1,6 @@
1
+ export const defaultMarkerNameDefault = () => "Marker";
2
+ export const prefixesDefault = {
3
+ "Scrolly mark": "#mark",
4
+ "Scrolly opener": "#scrollytellerNAMEscrolly1",
5
+ "Standalone graphic": "#graphic",
6
+ };
@@ -0,0 +1,2 @@
1
+ type MarkerPrefixes = Record<string, string>;
2
+ type DefaultMarkerNameFunction = (marker: string) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abcnews/components-builder",
3
- "version": "0.0.16",
3
+ "version": "0.0.17",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",
@@ -46,6 +46,7 @@
46
46
  "@sveltejs/kit": "^2.16.0",
47
47
  "@sveltejs/package": "^2.0.0",
48
48
  "@sveltejs/vite-plugin-svelte": "^5.0.0",
49
+ "@types/async": "^3.2.25",
49
50
  "@types/node": "^20",
50
51
  "prettier": "^3.4.2",
51
52
  "prettier-plugin-svelte": "^3.3.3",