@gui-chat-plugin/sequence 0.5.2 → 0.5.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.4
4
+
5
+ - **A story is told aloud, panel by panel.** Asked to tell a panel and call the next one in the same
6
+ reply, OpenAI's Realtime and Grok called it without a word: six panels went by in 25 seconds,
7
+ silent, while the pictures were drawn. The cast and each panel are now told in a reply of their
8
+ own, and the host's sequence keeper asks for the next panel when it ends, as slides have been since
9
+ 0.5.3. Checked in MulmoChat (Storyteller role, mock images): every panel told aloud, 52–73 words
10
+ a panel on OpenAI's Realtime, 57–69 on Grok, 28–38 on Gemini Live. Interactive panels (with
11
+ choices) and the last panel are unchanged. A host needs `createSequenceKeeper` for a story to go
12
+ on by itself, as for a slideshow.
13
+
14
+ ## 0.5.3
15
+
16
+ - **A slide is explained in a reply of its own, and the host's sequence keeper asks for the next
17
+ one.** Asked to explain a slide and call the next in the same reply, OpenAI's Realtime said a
18
+ one-line preamble ("I'll walk through the figures, then move on") and called the next slide, so
19
+ slides went by unexplained (all six, in one run). With no call to make in that reply, it
20
+ explained every slide in 6 slideshows of 6; Gemini Live and Grok go on as before. A host needs
21
+ gui-chat-protocol's `createSequenceKeeper` for a slideshow to go on by itself (MulmoChat and
22
+ MulmoGlass have it); without one, it stops after each slide until the user says to go on.
23
+ - **Figures go on chart slides.** The prompt says to show the figures the model has (from a search,
24
+ a document or the user) in a chart with their exact values, units and period; that figures over
25
+ time, shares of a whole or values side by side are a chart, not a list or a table; never to draw
26
+ a chart, graph, table, dashboard or key figures as a picture; and never to invent figures. The
27
+ picture parameter says the same. In a business analysis, Gemini Live had drawn charts as
28
+ generated pictures with no real numbers, and OpenAI's Realtime had made text slides only.
29
+ - A slide holds only its subject, never notes about the model's work ("Search was successful").
30
+ - "Four to six slides" allows more when the subject or the role's instructions need them.
31
+
3
32
  ## 0.5.2
4
33
 
5
34
  - **The model explains the whole slide before the next one.** Grok Voice said one or two
package/README.md CHANGED
@@ -44,8 +44,13 @@ current result without its picture.
44
44
  Every shown step's result carries `sequence` (gui-chat-protocol 2.1): where the sequence is, or
45
45
  `null` when a step couldn't be shown. A host that wires gui-chat-protocol's `createSequenceKeeper`
46
46
  asks the model to go on when it ends a reply mid-slideshow, and passes `keeper.userSpokeAt()` as
47
- `context.userSpokeAt`. Without it the tools still work: each step asks for the next in its
48
- instructions, which models usually follow.
47
+ `context.userSpokeAt`. A slideshow needs it: a slide's instructions ask the model only to explain
48
+ the slide, in a reply of its own, and the keeper asks for the next one when that reply ends (asked
49
+ for both in one reply, voice models announced the next slide instead of explaining this one).
50
+ Stories work the same way: the cast and each panel are told in a reply of their own, and the keeper
51
+ asks for the next panel. Without a keeper, a slideshow or a story stops after each step until the
52
+ user says to go on. Step-by-step guides and interactive panels (with choices) wait for the user
53
+ anyway.
49
54
 
50
55
  Step results also set `instructionsRequired`, so a turn-based host (text chat) takes a turn for the
51
56
  model to explain the step.
@@ -110,7 +110,7 @@ export interface StoryboardArgs {
110
110
  }
111
111
  /** The arguments, or what is wrong with them (said to the model). */
112
112
  export declare function parseStoryboardArgs(args: Record<string, unknown>): StoryboardArgs | string;
113
- export declare const castShownInstructions: ({ title, id }: Storyboard) => string;
113
+ export declare const castShownInstructions: ({ title }: Storyboard) => string;
114
114
  /** The cast's result data. */
115
115
  export interface CastData {
116
116
  storyboardId: string;
@@ -254,12 +254,12 @@ var D = "teach its subject as a presenter speaking to the audience, and cover ev
254
254
  return e < t ? `${n} is now on the screen. Say what to do in this step, directly ("Crack two eggs into a bowl…", not "This step is about eggs"), then stop and wait while the user does it. When they say they're ready (next, done, go on), call presentSlide for step ${e + 1} with mode "steps". If they ask to go back or to see a step again, call presentSlide for that step.` : `${n}, the last one, is now on the screen. Say what to do, directly, then wrap up the guide once the user is done.`;
255
255
  }
256
256
  let a = `Slide ${e} of ${t}${i}`;
257
- return e < t ? `${a} is now on the screen. Explain it: ${D} Then, in this same reply and without waiting for the user, call presentSlide for slide ${e + 1}: the call is the last thing in your reply, after your whole explanation, and ends it. Nothing you meant to say after it is heard, so a sentence and then the call leaves the slide unexplained. If the user has asked you to stop, or asked something else, since the slideshow began, answer them instead of going on.` : `${a}, the last one, is now on the screen. Explain it: ${D} Then wrap up the slideshow.`;
257
+ return e < t ? `${a} is now on the screen. Explain it: ${D} This reply is only the explanation: don't call presentSlide in it. When you have finished, you will be asked for slide ${e + 1}. If the user has asked you to stop, or asked something else, since the slideshow began, answer them instead of going on.` : `${a}, the last one, is now on the screen. Explain it: ${D} Then wrap up the slideshow.`;
258
258
  }, he = [
259
259
  `For an HTML slide, instead of imagePrompt: the slide's content, the inside of <body> only (no <html>, <head> or <body> tags), for a ${t}x720 px canvas, which it should fill (start with a <div class="w-full h-full ...">). Style it with Tailwind CSS v4 classes, which are loaded for you: a clear layout, a large title (text-6xl or so), few words in large type, a color scheme, and inline SVG or emoji for icons and diagrams. There is no network: no <img> from URLs, no links to follow.`,
260
260
  "Animate it so it builds up as you explain it, with MulmoCast's data-animation attributes (the same ones make it move in a movie of the slideshow): data-animation=\"animate\" with data-opacity=\"0,1\", data-translate-x, data-translate-y (px), data-scale, data-rotate (deg), data-width or data-height (\"0,80,%\"), each \"from,to\"; data-animation=\"counter\" with data-from, data-to, data-decimals, data-prefix, data-suffix; data-animation=\"typewriter\" (its text, or data-text). Give every one data-start and data-end in seconds, and optionally data-easing (linear, easeIn, easeOut, easeInOut); stagger the parts with later data-start values so they appear one after another over a few seconds (for example 0, 0.6, 1.2). Set the first frame inline too (style=\"opacity:0\" on an element that fades in).",
261
261
  "CSS animations, transitions and scripts don't play: animate only with data-animation. A <style> for layout is allowed (and Google Fonts by @import)."
262
- ].join(" "), ge = "For a Markdown slide, instead of imagePrompt: the slide in Markdown (GitHub's: headings, lists, bold, tables, code), with math in TeX between $...$ inline or $$...$$ for a displayed equation (on lines of its own). Start with a # heading, and keep it to what fits on one slide: a heading and a few lines, a list or an equation or two. Write a dollar sign that isn't math as \\$.", _e = `For a chart slide, instead of imagePrompt: a Chart.js configuration as JSON text, {"type": ..., "data": ...}: { type, data: { labels, datasets: [{ label, data, backgroundColor }] }, options }. type is one of ${h.join(", ")}. It is drawn under the slide's title, so leave out options.plugins.title; give the datasets colors, and the axes titles (options.scales.x.title) when their units aren't obvious. JSON values only: no functions.`, k = "When the user asks for a slideshow (or to explain something with slides), plan four to six slides, then show them one at a time with presentSlide: slide 1 first, and each next slide only after you have explained the one on the screen. Explain the subject, not the slides: say what the slide teaches, not that a slide is about it, and explain everything on a slide before showing the next; put on a slide only what you will explain. Go on to the last slide without asking whether to continue. A slide is a generated picture (imagePrompt), a chart (chart), a text slide in Markdown (markdown) or a designed slide in HTML (html): use a picture for a scene, an object or a place; a chart for numbers to compare, a trend or proportions; Markdown for equations and formulas (TeX math), definitions, short lists and small tables; and HTML for designed layouts, comparisons, timelines and diagrams. A picture model draws words, numbers and math badly, so they go on the other kinds; a slideshow can mix them. When the user asks for HTML slides (slides in HTML, an HTML presentation), this is the tool: make them HTML slides with presentSlide, one call per slide, not one HTML page. When the user wants to be shown how to do something they will do along with you (cooking, folding, fixing, an exercise), make it a step-by-step guide instead: mode \"steps\", one slide per step, and after each step wait for the user to say they are ready. Use generateImage for a single picture, not for slides.", A = {
262
+ ].join(" "), ge = "For a Markdown slide, instead of imagePrompt: the slide in Markdown (GitHub's: headings, lists, bold, tables, code), with math in TeX between $...$ inline or $$...$$ for a displayed equation (on lines of its own). Start with a # heading, and keep it to what fits on one slide: a heading and a few lines, a list or an equation or two. Write a dollar sign that isn't math as \\$.", _e = `For a chart slide, instead of imagePrompt (for numbers: real figures you have, never a picture of a chart): a Chart.js configuration as JSON text, {"type": ..., "data": ...}: { type, data: { labels, datasets: [{ label, data, backgroundColor }] }, options }. type is one of ${h.join(", ")}. It is drawn under the slide's title, so leave out options.plugins.title; give the datasets colors, and the axes titles (options.scales.x.title) when their units aren't obvious. JSON values only: no functions.`, k = "When the user asks for a slideshow (or to explain something with slides), plan four to six slides (more when the subject or your instructions need them), then show them one at a time with presentSlide: slide 1 first, and each next slide only after you have explained the one on the screen. Explain the subject, not the slides: say what the slide teaches, not that a slide is about it, and explain everything on a slide before showing the next; put on a slide only what you will explain. Go on to the last slide without asking whether to continue. A slide is a generated picture (imagePrompt), a chart (chart), a text slide in Markdown (markdown) or a designed slide in HTML (html): use a picture for a scene, an object or a place; a chart for numbers to compare, a trend or proportions; Markdown for equations and formulas (TeX math), definitions, short lists and small tables; and HTML for designed layouts, comparisons, timelines and diagrams. A picture model draws words, numbers and math badly, so they go on the other kinds; a slideshow can mix them. Numbers go on a chart slide: when you have figures (from a search, a document or the user: revenue, market share, growth, prices, counts over time), show them in a chart with those exact values, labelled with their units and the year or period, and say where they come from. Figures over time, shares of a whole or values side by side are a chart, not a list or table on a Markdown or HTML slide. Never make a chart, graph or table a picture (imagePrompt): a picture of a chart has made-up bars and no real numbers. A slideshow about a business, a market or a comparison of companies has its figures on chart slides, not only in text. Never invent figures; with none to show, leave the chart out. A slide holds only its subject, never notes about your work (what you searched for, that a search succeeded). When the user asks for HTML slides (slides in HTML, an HTML presentation), this is the tool: make them HTML slides with presentSlide, one call per slide, not one HTML page. When the user wants to be shown how to do something they will do along with you (cooking, folding, fixing, an exercise), make it a step-by-step guide instead: mode \"steps\", one slide per step, and after each step wait for the user to say they are ready. Use generateImage for a single picture, not for slides.", A = {
263
263
  type: "function",
264
264
  name: _,
265
265
  prompt: k,
@@ -281,7 +281,7 @@ var D = "teach its subject as a presenter speaking to the audience, and cover ev
281
281
  },
282
282
  imagePrompt: {
283
283
  type: "string",
284
- description: "For a picture slide: the picture, a clear illustration of its point, with the title as its only large text. Be concrete. For a step, show the action: hands, tools and the object. Leave it out for a chart, Markdown or HTML slide."
284
+ description: "For a picture slide: the picture, a clear illustration of its point, with the title as its only large text. Be concrete. Never a chart, graph, table, dashboard, infographic, key figures or anything with numbers: those are chart, Markdown or HTML slides. For a step, show the action: hands, tools and the object. Leave it out for a chart, Markdown or HTML slide."
285
285
  },
286
286
  html: {
287
287
  type: "string",
@@ -329,7 +329,7 @@ function j(e) {
329
329
  interactive: e.interactive === !0
330
330
  };
331
331
  }
332
- var M = ({ title: e, id: t }) => `The cast of "${e}" is now on the screen. Introduce the characters briefly, then, in this same reply and without waiting for the user, call presentPanel for panel 1 with storyboardId "${t}". If the user has asked you to stop, or asked something else, answer them instead of going on.`, N = "presentPanel needs a storyboardId, a panel number (from 1) and an imagePrompt";
332
+ var M = ({ title: e }) => `The cast of "${e}" is now on the screen. Introduce the characters briefly. This reply is only the introduction: don't call presentPanel in it. When you have finished, you will be asked for panel 1. If the user has asked you to stop, or asked something else, answer them instead of going on.`, N = "presentPanel needs a storyboardId, a panel number (from 1) and an imagePrompt";
333
333
  function P(e) {
334
334
  let { panel: t } = e, n = b(e.storyboardId), r = b(e.imagePrompt);
335
335
  if (!n || !r || !S(t) || t < 1) return null;
@@ -345,7 +345,7 @@ function P(e) {
345
345
  }
346
346
  function F(e, t, n) {
347
347
  let { id: r, totalPanels: i } = e;
348
- return n.length ? `Panel ${t} of ${i} is now on the screen, with the user's choices: ${n.map((e, t) => `${t + 1}. ${e}`).join(" ")} Tell this part of the story, then read the choices out and ask the user which one they pick, and wait for their answer. Then call presentPanel for panel ${t + 1} with storyboardId "${r}", going on the way they chose.` : t < i ? `Panel ${t} of ${i} is now on the screen. Tell this part of the story, then, in this same reply and without waiting for the user, call presentPanel for panel ${t + 1} with storyboardId "${r}". If the user has asked you to stop, or asked something else, since the story began, answer them instead of going on.` : `Panel ${t} of ${i}, the last one, is now on the screen. Tell this part of the story, then bring it to an end.`;
348
+ return n.length ? `Panel ${t} of ${i} is now on the screen, with the user's choices: ${n.map((e, t) => `${t + 1}. ${e}`).join(" ")} Tell this part of the story, then read the choices out and ask the user which one they pick, and wait for their answer. Then call presentPanel for panel ${t + 1} with storyboardId "${r}", going on the way they chose.` : t < i ? `Panel ${t} of ${i} is now on the screen. Tell this part of the story, aloud, as a storyteller. This reply is only the telling: don't call presentPanel in it. When you have finished, you will be asked for panel ${t + 1}. If the user has asked you to stop, or asked something else, since the story began, answer them instead of going on.` : `Panel ${t} of ${i}, the last one, is now on the screen. Tell this part of the story, then bring it to an end.`;
349
349
  }
350
350
  var ve = "When the user asks for a story, a picture book, a comic or a storyboard, tell it in pictures: first call defineStoryboard with the art style and the characters who appear more than once (it draws a reference sheet for each, so they look the same in every panel), then show the panels one at a time with presentPanel, naming the characters in each, and tell each part of the story when its panel appears. Go on to the last panel without asking whether to continue, unless the story is interactive. When the user wants to decide what happens (an adventure, a story for a child who wants to choose), set interactive, and give two or three choices on two or three of the panels: the story waits there for the user's pick and goes on their way; it still ends at the last panel whichever way it goes. Use presentSlide to explain a topic, not to tell a story.", I = {
351
351
  type: "function",
@@ -202,7 +202,7 @@ ${e?`<h1>${p(e)}</h1>`:``}
202
202
  <div class="chart"><canvas id="chart"></canvas></div>
203
203
  <p id="chart-error"></p>
204
204
  </body>
205
- </html>`}var _=`presentSlide`,le=`defineStoryboard`,ue=`presentPanel`,de=4,fe=12,pe=3,v=/^[0-9a-f]{12}$/,y=e=>typeof e==`object`&&!!e&&!Array.isArray(e),b=e=>typeof e==`string`?e.trim():``,x=(e,t)=>e.toLowerCase()===t.toLowerCase(),S=e=>typeof e==`number`&&Number.isInteger(e),C=`presentSlide needs slide and totalSlides (whole numbers, slide from 1 to totalSlides), and one of imagePrompt, html, markdown or chart`,w=`presentSlide's slide is too long: keep its html, markdown or chart under ${r} characters`,T=`presentSlide's chart must be a Chart.js configuration: an object with type (${h.join(`, `)}), data ({ labels, datasets }) and optionally options`;function me(e){let t=e;if(typeof t==`string`)try{t=JSON.parse(t)}catch{return null}if(!y(t)||!y(t.data))return null;let n=t.type;return!h.some(e=>e===n)||t.options!==void 0&&!y(t.options)?null:t}function E(e){let{slide:t,totalSlides:n,title:r,imagePrompt:i}=e,a=b(e.html),o=a?``:b(e.markdown),s=!a&&!o&&e.chart!==void 0&&e.chart!==null;if(!S(t)||!S(n)||t<1||n<t||!a&&!o&&!s&&!b(i))return C;let c=s?me(e.chart):null;return s&&!c?T:Math.max(a.length,o.length,c?JSON.stringify(c).length:0)>6e4?w:{slide:t,totalSlides:n,title:typeof r==`string`?r:``,imagePrompt:!a&&!o&&!c?String(i):``,...a&&{html:a},...o&&{markdown:o},...c&&{chart:c},mode:e.mode===`steps`?`steps`:`presentation`}}var D=`teach its subject as a presenter speaking to the audience, and cover everything on it: every section, point and number, in order, each in a sentence or more. The slide is replaced by the next one as soon as you stop talking, so a point you leave out is never explained. Begin with the content itself, never with the slide or your plan: no "This slide is about…", "The first slide shows…", "Let's unpack this one", "Next, I'll…". A line about the slide is not an explanation.`,O=({slide:e,totalSlides:t,title:n,mode:r})=>{let i=n?` ("${n}")`:``;if(r===`steps`){let n=`Step ${e} of ${t}${i}`;return e<t?`${n} is now on the screen. Say what to do in this step, directly ("Crack two eggs into a bowl…", not "This step is about eggs"), then stop and wait while the user does it. When they say they're ready (next, done, go on), call presentSlide for step ${e+1} with mode "steps". If they ask to go back or to see a step again, call presentSlide for that step.`:`${n}, the last one, is now on the screen. Say what to do, directly, then wrap up the guide once the user is done.`}let a=`Slide ${e} of ${t}${i}`;return e<t?`${a} is now on the screen. Explain it: ${D} Then, in this same reply and without waiting for the user, call presentSlide for slide ${e+1}: the call is the last thing in your reply, after your whole explanation, and ends it. Nothing you meant to say after it is heard, so a sentence and then the call leaves the slide unexplained. If the user has asked you to stop, or asked something else, since the slideshow began, answer them instead of going on.`:`${a}, the last one, is now on the screen. Explain it: ${D} Then wrap up the slideshow.`},he=[`For an HTML slide, instead of imagePrompt: the slide's content, the inside of <body> only (no <html>, <head> or <body> tags), for a ${t}x720 px canvas, which it should fill (start with a <div class="w-full h-full ...">). Style it with Tailwind CSS v4 classes, which are loaded for you: a clear layout, a large title (text-6xl or so), few words in large type, a color scheme, and inline SVG or emoji for icons and diagrams. There is no network: no <img> from URLs, no links to follow.`,`Animate it so it builds up as you explain it, with MulmoCast's data-animation attributes (the same ones make it move in a movie of the slideshow): data-animation="animate" with data-opacity="0,1", data-translate-x, data-translate-y (px), data-scale, data-rotate (deg), data-width or data-height ("0,80,%"), each "from,to"; data-animation="counter" with data-from, data-to, data-decimals, data-prefix, data-suffix; data-animation="typewriter" (its text, or data-text). Give every one data-start and data-end in seconds, and optionally data-easing (linear, easeIn, easeOut, easeInOut); stagger the parts with later data-start values so they appear one after another over a few seconds (for example 0, 0.6, 1.2). Set the first frame inline too (style="opacity:0" on an element that fades in).`,`CSS animations, transitions and scripts don't play: animate only with data-animation. A <style> for layout is allowed (and Google Fonts by @import).`].join(` `),ge=`For a Markdown slide, instead of imagePrompt: the slide in Markdown (GitHub's: headings, lists, bold, tables, code), with math in TeX between $...$ inline or $$...$$ for a displayed equation (on lines of its own). Start with a # heading, and keep it to what fits on one slide: a heading and a few lines, a list or an equation or two. Write a dollar sign that isn't math as \\$.`,_e=`For a chart slide, instead of imagePrompt: a Chart.js configuration as JSON text, {"type": ..., "data": ...}: { type, data: { labels, datasets: [{ label, data, backgroundColor }] }, options }. type is one of ${h.join(`, `)}. It is drawn under the slide's title, so leave out options.plugins.title; give the datasets colors, and the axes titles (options.scales.x.title) when their units aren't obvious. JSON values only: no functions.`,k=`When the user asks for a slideshow (or to explain something with slides), plan four to six slides, then show them one at a time with presentSlide: slide 1 first, and each next slide only after you have explained the one on the screen. Explain the subject, not the slides: say what the slide teaches, not that a slide is about it, and explain everything on a slide before showing the next; put on a slide only what you will explain. Go on to the last slide without asking whether to continue. A slide is a generated picture (imagePrompt), a chart (chart), a text slide in Markdown (markdown) or a designed slide in HTML (html): use a picture for a scene, an object or a place; a chart for numbers to compare, a trend or proportions; Markdown for equations and formulas (TeX math), definitions, short lists and small tables; and HTML for designed layouts, comparisons, timelines and diagrams. A picture model draws words, numbers and math badly, so they go on the other kinds; a slideshow can mix them. When the user asks for HTML slides (slides in HTML, an HTML presentation), this is the tool: make them HTML slides with presentSlide, one call per slide, not one HTML page. When the user wants to be shown how to do something they will do along with you (cooking, folding, fixing, an exercise), make it a step-by-step guide instead: mode "steps", one slide per step, and after each step wait for the user to say they are ready. Use generateImage for a single picture, not for slides.`,A={type:`function`,name:_,prompt:k,description:`Show one slide of a slideshow, full screen: a picture generated from imagePrompt, a chart (chart), a slide written in Markdown with TeX math (markdown), or a slide written in HTML (html). Give one of the four. Call it once per slide, in order, starting with slide 1. With mode "steps" it is a step-by-step guide: one slide per step, and the next step waits for the user.`,parameters:{type:`object`,properties:{slide:{type:`integer`,description:`This slide's number, starting at 1.`},totalSlides:{type:`integer`,description:`How many slides the slideshow has. Keep it the same for every slide.`},title:{type:`string`,description:`The slide's title.`},imagePrompt:{type:`string`,description:`For a picture slide: the picture, a clear illustration of its point, with the title as its only large text. Be concrete. For a step, show the action: hands, tools and the object. Leave it out for a chart, Markdown or HTML slide.`},html:{type:`string`,description:he},markdown:{type:`string`,description:ge},chart:{type:`string`,description:_e},mode:{type:`string`,enum:[`presentation`,`steps`],description:`"presentation" (the default) goes on by itself; "steps" is a how-to the user does along with you, and waits for them after each step. Keep it the same for every slide.`}},required:[`slide`,`totalSlides`,`title`]}};function j(e){let{totalPanels:t}=e;if(!S(t)||t<1||t>12)return`totalPanels must be a whole number from 1 to 12`;let n=[];for(let t of Array.isArray(e.characters)?e.characters:[]){let e=y(t)?b(t.name):``,r=y(t)?b(t.description):``;if(!e||!r)return`every character needs a name and a description`;if(n.some(t=>x(t.name,e)))return`two characters are named ${e}`;n.push({name:e,description:r})}return n.length<1||n.length>4?`a storyboard has 1 to 4 characters`:{title:b(e.title),style:b(e.style),totalPanels:t,characters:n,interactive:e.interactive===!0}}var M=({title:e,id:t})=>`The cast of "${e}" is now on the screen. Introduce the characters briefly, then, in this same reply and without waiting for the user, call presentPanel for panel 1 with storyboardId "${t}". If the user has asked you to stop, or asked something else, answer them instead of going on.`,N=`presentPanel needs a storyboardId, a panel number (from 1) and an imagePrompt`;function P(e){let{panel:t}=e,n=b(e.storyboardId),r=b(e.imagePrompt);if(!n||!r||!S(t)||t<1)return null;let i=e=>(Array.isArray(e)?e:[]).map(b).filter(Boolean);return{storyboardId:n,panel:t,characters:i(e.characters),imagePrompt:r,caption:b(e.caption),choices:i(e.choices).slice(0,3)}}function F(e,t,n){let{id:r,totalPanels:i}=e;return n.length?`Panel ${t} of ${i} is now on the screen, with the user's choices: ${n.map((e,t)=>`${t+1}. ${e}`).join(` `)} Tell this part of the story, then read the choices out and ask the user which one they pick, and wait for their answer. Then call presentPanel for panel ${t+1} with storyboardId "${r}", going on the way they chose.`:t<i?`Panel ${t} of ${i} is now on the screen. Tell this part of the story, then, in this same reply and without waiting for the user, call presentPanel for panel ${t+1} with storyboardId "${r}". If the user has asked you to stop, or asked something else, since the story began, answer them instead of going on.`:`Panel ${t} of ${i}, the last one, is now on the screen. Tell this part of the story, then bring it to an end.`}var ve=`When the user asks for a story, a picture book, a comic or a storyboard, tell it in pictures: first call defineStoryboard with the art style and the characters who appear more than once (it draws a reference sheet for each, so they look the same in every panel), then show the panels one at a time with presentPanel, naming the characters in each, and tell each part of the story when its panel appears. Go on to the last panel without asking whether to continue, unless the story is interactive. When the user wants to decide what happens (an adventure, a story for a child who wants to choose), set interactive, and give two or three choices on two or three of the panels: the story waits there for the user's pick and goes on their way; it still ends at the last panel whichever way it goes. Use presentSlide to explain a topic, not to tell a story.`,I={type:`function`,name:le,prompt:ve,description:`Start a story told in pictures: set its art style and draw a reference sheet for each recurring character, shown as the cast. Then call presentPanel for each panel, in order.`,parameters:{type:`object`,properties:{title:{type:`string`,description:`The story's title.`},style:{type:`string`,description:`The art style of every picture, in one sentence (for example: soft watercolor, children's picture book).`},totalPanels:{type:`integer`,description:`How many panels the story has, at most 12; four to eight is usual.`},interactive:{type:`boolean`,description:`The user chooses what happens: panels can offer choices, and the story waits for the pick.`},characters:{type:`array`,description:`The characters who appear in more than one panel, 1 to 4.`,items:{type:`object`,properties:{name:{type:`string`,description:`A short name, used in presentPanel.`},description:{type:`string`,description:`How they look: age, build, face, hair, clothes and colors. Be concrete: it is drawn once and reused in every panel.`}},required:[`name`,`description`]}}},required:[`title`,`style`,`totalPanels`,`characters`]}},L={type:`function`,name:ue,description:`Show one panel of a storyboard made with defineStoryboard: a picture of the scene with its characters drawn as in their reference sheets, and a caption. Call it once per panel, in order, starting with panel 1.`,parameters:{type:`object`,properties:{storyboardId:{type:`string`,description:`The storyboardId defineStoryboard returned.`},panel:{type:`integer`,description:`This panel's number, starting at 1.`},characters:{type:`array`,items:{type:`string`},description:`The names (as in defineStoryboard) of the characters in this panel.`},imagePrompt:{type:`string`,description:`What the panel shows: the setting, what happens, expressions and the camera angle. Refer to characters by name; don't describe their looks again.`},caption:{type:`string`,description:`One short line shown under the picture.`},choices:{type:`array`,items:{type:`string`},description:`Only in an interactive story, and not on the last panel: two or three short options for what happens next. The story waits for the user's pick.`}},required:[`storyboardId`,`panel`,`characters`,`imagePrompt`]}},R=e=>typeof e==`object`&&!!e&&!Array.isArray(e),ye=e=>R(e)&&typeof e.message==`string`;function z(e){let t=R(e?.data)?e.data:{};return{...typeof t.imageData==`string`&&{imageData:t.imageData},...typeof t.imagePath==`string`&&{imagePath:t.imagePath}}}function B(e){let t=R(e?.data)?e.data:{};return typeof t.html==`string`?t.html:``}function V(e){let t=R(e?.data)?e.data:{};return R(t.chart)?JSON.stringify(t.chart):``}var be=e=>!!z(e).imageData||!!B(e)||!!V(e);function xe(e,t){let n=z(e),r=z(t);if(n.imagePath&&r.imagePath)return n.imagePath===r.imagePath;if(n.imageData)return n.imageData===r.imageData;let i=B(e);if(i)return i===B(t);let a=V(e);return!!a&&a===V(t)}var H=(e,t)=>e.userSpokeAt===void 0||e.userSpokeAt>t,U=()=>crypto.randomUUID().replace(/-/g,``).slice(0,12),Se=`artifacts/`;async function W(e,t){let n=e.files?.artifacts;if(!e.app?.editImages||!n)return[];let r=[];for(let e of t)if(e.startsWith(Se))try{await n.exists(e.slice(10))&&r.push(e)}catch{}return r}async function G(e,t,n=[]){let r=e.app,i=r?.editImages,a=r?.generateImage;try{let e;if(n.length&&i)e=await i(t,[...n]);else if(a)e=await a(t);else return{message:`image generation isn't available`};return ye(e)?e:{message:`image generation returned an unrecognized result`}}catch(e){return{message:`image generation failed: ${e instanceof Error?e.message:String(e)}`}}}var Ce=50;function K(e){let t=new Map;return n=>{let r=n.conversationId??``,i=t.get(r);if(i===void 0?i=e():t.delete(r),t.set(r,i),t.size>Ce){let e=t.keys().next().value;e!==void 0&&t.delete(e)}return i}}var q=`slide-md`,we=`
205
+ </html>`}var _=`presentSlide`,le=`defineStoryboard`,ue=`presentPanel`,de=4,fe=12,pe=3,v=/^[0-9a-f]{12}$/,y=e=>typeof e==`object`&&!!e&&!Array.isArray(e),b=e=>typeof e==`string`?e.trim():``,x=(e,t)=>e.toLowerCase()===t.toLowerCase(),S=e=>typeof e==`number`&&Number.isInteger(e),C=`presentSlide needs slide and totalSlides (whole numbers, slide from 1 to totalSlides), and one of imagePrompt, html, markdown or chart`,w=`presentSlide's slide is too long: keep its html, markdown or chart under ${r} characters`,T=`presentSlide's chart must be a Chart.js configuration: an object with type (${h.join(`, `)}), data ({ labels, datasets }) and optionally options`;function me(e){let t=e;if(typeof t==`string`)try{t=JSON.parse(t)}catch{return null}if(!y(t)||!y(t.data))return null;let n=t.type;return!h.some(e=>e===n)||t.options!==void 0&&!y(t.options)?null:t}function E(e){let{slide:t,totalSlides:n,title:r,imagePrompt:i}=e,a=b(e.html),o=a?``:b(e.markdown),s=!a&&!o&&e.chart!==void 0&&e.chart!==null;if(!S(t)||!S(n)||t<1||n<t||!a&&!o&&!s&&!b(i))return C;let c=s?me(e.chart):null;return s&&!c?T:Math.max(a.length,o.length,c?JSON.stringify(c).length:0)>6e4?w:{slide:t,totalSlides:n,title:typeof r==`string`?r:``,imagePrompt:!a&&!o&&!c?String(i):``,...a&&{html:a},...o&&{markdown:o},...c&&{chart:c},mode:e.mode===`steps`?`steps`:`presentation`}}var D=`teach its subject as a presenter speaking to the audience, and cover everything on it: every section, point and number, in order, each in a sentence or more. The slide is replaced by the next one as soon as you stop talking, so a point you leave out is never explained. Begin with the content itself, never with the slide or your plan: no "This slide is about…", "The first slide shows…", "Let's unpack this one", "Next, I'll…". A line about the slide is not an explanation.`,O=({slide:e,totalSlides:t,title:n,mode:r})=>{let i=n?` ("${n}")`:``;if(r===`steps`){let n=`Step ${e} of ${t}${i}`;return e<t?`${n} is now on the screen. Say what to do in this step, directly ("Crack two eggs into a bowl…", not "This step is about eggs"), then stop and wait while the user does it. When they say they're ready (next, done, go on), call presentSlide for step ${e+1} with mode "steps". If they ask to go back or to see a step again, call presentSlide for that step.`:`${n}, the last one, is now on the screen. Say what to do, directly, then wrap up the guide once the user is done.`}let a=`Slide ${e} of ${t}${i}`;return e<t?`${a} is now on the screen. Explain it: ${D} This reply is only the explanation: don't call presentSlide in it. When you have finished, you will be asked for slide ${e+1}. If the user has asked you to stop, or asked something else, since the slideshow began, answer them instead of going on.`:`${a}, the last one, is now on the screen. Explain it: ${D} Then wrap up the slideshow.`},he=[`For an HTML slide, instead of imagePrompt: the slide's content, the inside of <body> only (no <html>, <head> or <body> tags), for a ${t}x720 px canvas, which it should fill (start with a <div class="w-full h-full ...">). Style it with Tailwind CSS v4 classes, which are loaded for you: a clear layout, a large title (text-6xl or so), few words in large type, a color scheme, and inline SVG or emoji for icons and diagrams. There is no network: no <img> from URLs, no links to follow.`,`Animate it so it builds up as you explain it, with MulmoCast's data-animation attributes (the same ones make it move in a movie of the slideshow): data-animation="animate" with data-opacity="0,1", data-translate-x, data-translate-y (px), data-scale, data-rotate (deg), data-width or data-height ("0,80,%"), each "from,to"; data-animation="counter" with data-from, data-to, data-decimals, data-prefix, data-suffix; data-animation="typewriter" (its text, or data-text). Give every one data-start and data-end in seconds, and optionally data-easing (linear, easeIn, easeOut, easeInOut); stagger the parts with later data-start values so they appear one after another over a few seconds (for example 0, 0.6, 1.2). Set the first frame inline too (style="opacity:0" on an element that fades in).`,`CSS animations, transitions and scripts don't play: animate only with data-animation. A <style> for layout is allowed (and Google Fonts by @import).`].join(` `),ge=`For a Markdown slide, instead of imagePrompt: the slide in Markdown (GitHub's: headings, lists, bold, tables, code), with math in TeX between $...$ inline or $$...$$ for a displayed equation (on lines of its own). Start with a # heading, and keep it to what fits on one slide: a heading and a few lines, a list or an equation or two. Write a dollar sign that isn't math as \\$.`,_e=`For a chart slide, instead of imagePrompt (for numbers: real figures you have, never a picture of a chart): a Chart.js configuration as JSON text, {"type": ..., "data": ...}: { type, data: { labels, datasets: [{ label, data, backgroundColor }] }, options }. type is one of ${h.join(`, `)}. It is drawn under the slide's title, so leave out options.plugins.title; give the datasets colors, and the axes titles (options.scales.x.title) when their units aren't obvious. JSON values only: no functions.`,k=`When the user asks for a slideshow (or to explain something with slides), plan four to six slides (more when the subject or your instructions need them), then show them one at a time with presentSlide: slide 1 first, and each next slide only after you have explained the one on the screen. Explain the subject, not the slides: say what the slide teaches, not that a slide is about it, and explain everything on a slide before showing the next; put on a slide only what you will explain. Go on to the last slide without asking whether to continue. A slide is a generated picture (imagePrompt), a chart (chart), a text slide in Markdown (markdown) or a designed slide in HTML (html): use a picture for a scene, an object or a place; a chart for numbers to compare, a trend or proportions; Markdown for equations and formulas (TeX math), definitions, short lists and small tables; and HTML for designed layouts, comparisons, timelines and diagrams. A picture model draws words, numbers and math badly, so they go on the other kinds; a slideshow can mix them. Numbers go on a chart slide: when you have figures (from a search, a document or the user: revenue, market share, growth, prices, counts over time), show them in a chart with those exact values, labelled with their units and the year or period, and say where they come from. Figures over time, shares of a whole or values side by side are a chart, not a list or table on a Markdown or HTML slide. Never make a chart, graph or table a picture (imagePrompt): a picture of a chart has made-up bars and no real numbers. A slideshow about a business, a market or a comparison of companies has its figures on chart slides, not only in text. Never invent figures; with none to show, leave the chart out. A slide holds only its subject, never notes about your work (what you searched for, that a search succeeded). When the user asks for HTML slides (slides in HTML, an HTML presentation), this is the tool: make them HTML slides with presentSlide, one call per slide, not one HTML page. When the user wants to be shown how to do something they will do along with you (cooking, folding, fixing, an exercise), make it a step-by-step guide instead: mode "steps", one slide per step, and after each step wait for the user to say they are ready. Use generateImage for a single picture, not for slides.`,A={type:`function`,name:_,prompt:k,description:`Show one slide of a slideshow, full screen: a picture generated from imagePrompt, a chart (chart), a slide written in Markdown with TeX math (markdown), or a slide written in HTML (html). Give one of the four. Call it once per slide, in order, starting with slide 1. With mode "steps" it is a step-by-step guide: one slide per step, and the next step waits for the user.`,parameters:{type:`object`,properties:{slide:{type:`integer`,description:`This slide's number, starting at 1.`},totalSlides:{type:`integer`,description:`How many slides the slideshow has. Keep it the same for every slide.`},title:{type:`string`,description:`The slide's title.`},imagePrompt:{type:`string`,description:`For a picture slide: the picture, a clear illustration of its point, with the title as its only large text. Be concrete. Never a chart, graph, table, dashboard, infographic, key figures or anything with numbers: those are chart, Markdown or HTML slides. For a step, show the action: hands, tools and the object. Leave it out for a chart, Markdown or HTML slide.`},html:{type:`string`,description:he},markdown:{type:`string`,description:ge},chart:{type:`string`,description:_e},mode:{type:`string`,enum:[`presentation`,`steps`],description:`"presentation" (the default) goes on by itself; "steps" is a how-to the user does along with you, and waits for them after each step. Keep it the same for every slide.`}},required:[`slide`,`totalSlides`,`title`]}};function j(e){let{totalPanels:t}=e;if(!S(t)||t<1||t>12)return`totalPanels must be a whole number from 1 to 12`;let n=[];for(let t of Array.isArray(e.characters)?e.characters:[]){let e=y(t)?b(t.name):``,r=y(t)?b(t.description):``;if(!e||!r)return`every character needs a name and a description`;if(n.some(t=>x(t.name,e)))return`two characters are named ${e}`;n.push({name:e,description:r})}return n.length<1||n.length>4?`a storyboard has 1 to 4 characters`:{title:b(e.title),style:b(e.style),totalPanels:t,characters:n,interactive:e.interactive===!0}}var M=({title:e})=>`The cast of "${e}" is now on the screen. Introduce the characters briefly. This reply is only the introduction: don't call presentPanel in it. When you have finished, you will be asked for panel 1. If the user has asked you to stop, or asked something else, answer them instead of going on.`,N=`presentPanel needs a storyboardId, a panel number (from 1) and an imagePrompt`;function P(e){let{panel:t}=e,n=b(e.storyboardId),r=b(e.imagePrompt);if(!n||!r||!S(t)||t<1)return null;let i=e=>(Array.isArray(e)?e:[]).map(b).filter(Boolean);return{storyboardId:n,panel:t,characters:i(e.characters),imagePrompt:r,caption:b(e.caption),choices:i(e.choices).slice(0,3)}}function F(e,t,n){let{id:r,totalPanels:i}=e;return n.length?`Panel ${t} of ${i} is now on the screen, with the user's choices: ${n.map((e,t)=>`${t+1}. ${e}`).join(` `)} Tell this part of the story, then read the choices out and ask the user which one they pick, and wait for their answer. Then call presentPanel for panel ${t+1} with storyboardId "${r}", going on the way they chose.`:t<i?`Panel ${t} of ${i} is now on the screen. Tell this part of the story, aloud, as a storyteller. This reply is only the telling: don't call presentPanel in it. When you have finished, you will be asked for panel ${t+1}. If the user has asked you to stop, or asked something else, since the story began, answer them instead of going on.`:`Panel ${t} of ${i}, the last one, is now on the screen. Tell this part of the story, then bring it to an end.`}var ve=`When the user asks for a story, a picture book, a comic or a storyboard, tell it in pictures: first call defineStoryboard with the art style and the characters who appear more than once (it draws a reference sheet for each, so they look the same in every panel), then show the panels one at a time with presentPanel, naming the characters in each, and tell each part of the story when its panel appears. Go on to the last panel without asking whether to continue, unless the story is interactive. When the user wants to decide what happens (an adventure, a story for a child who wants to choose), set interactive, and give two or three choices on two or three of the panels: the story waits there for the user's pick and goes on their way; it still ends at the last panel whichever way it goes. Use presentSlide to explain a topic, not to tell a story.`,I={type:`function`,name:le,prompt:ve,description:`Start a story told in pictures: set its art style and draw a reference sheet for each recurring character, shown as the cast. Then call presentPanel for each panel, in order.`,parameters:{type:`object`,properties:{title:{type:`string`,description:`The story's title.`},style:{type:`string`,description:`The art style of every picture, in one sentence (for example: soft watercolor, children's picture book).`},totalPanels:{type:`integer`,description:`How many panels the story has, at most 12; four to eight is usual.`},interactive:{type:`boolean`,description:`The user chooses what happens: panels can offer choices, and the story waits for the pick.`},characters:{type:`array`,description:`The characters who appear in more than one panel, 1 to 4.`,items:{type:`object`,properties:{name:{type:`string`,description:`A short name, used in presentPanel.`},description:{type:`string`,description:`How they look: age, build, face, hair, clothes and colors. Be concrete: it is drawn once and reused in every panel.`}},required:[`name`,`description`]}}},required:[`title`,`style`,`totalPanels`,`characters`]}},L={type:`function`,name:ue,description:`Show one panel of a storyboard made with defineStoryboard: a picture of the scene with its characters drawn as in their reference sheets, and a caption. Call it once per panel, in order, starting with panel 1.`,parameters:{type:`object`,properties:{storyboardId:{type:`string`,description:`The storyboardId defineStoryboard returned.`},panel:{type:`integer`,description:`This panel's number, starting at 1.`},characters:{type:`array`,items:{type:`string`},description:`The names (as in defineStoryboard) of the characters in this panel.`},imagePrompt:{type:`string`,description:`What the panel shows: the setting, what happens, expressions and the camera angle. Refer to characters by name; don't describe their looks again.`},caption:{type:`string`,description:`One short line shown under the picture.`},choices:{type:`array`,items:{type:`string`},description:`Only in an interactive story, and not on the last panel: two or three short options for what happens next. The story waits for the user's pick.`}},required:[`storyboardId`,`panel`,`characters`,`imagePrompt`]}},R=e=>typeof e==`object`&&!!e&&!Array.isArray(e),ye=e=>R(e)&&typeof e.message==`string`;function z(e){let t=R(e?.data)?e.data:{};return{...typeof t.imageData==`string`&&{imageData:t.imageData},...typeof t.imagePath==`string`&&{imagePath:t.imagePath}}}function B(e){let t=R(e?.data)?e.data:{};return typeof t.html==`string`?t.html:``}function V(e){let t=R(e?.data)?e.data:{};return R(t.chart)?JSON.stringify(t.chart):``}var be=e=>!!z(e).imageData||!!B(e)||!!V(e);function xe(e,t){let n=z(e),r=z(t);if(n.imagePath&&r.imagePath)return n.imagePath===r.imagePath;if(n.imageData)return n.imageData===r.imageData;let i=B(e);if(i)return i===B(t);let a=V(e);return!!a&&a===V(t)}var H=(e,t)=>e.userSpokeAt===void 0||e.userSpokeAt>t,U=()=>crypto.randomUUID().replace(/-/g,``).slice(0,12),Se=`artifacts/`;async function W(e,t){let n=e.files?.artifacts;if(!e.app?.editImages||!n)return[];let r=[];for(let e of t)if(e.startsWith(Se))try{await n.exists(e.slice(10))&&r.push(e)}catch{}return r}async function G(e,t,n=[]){let r=e.app,i=r?.editImages,a=r?.generateImage;try{let e;if(n.length&&i)e=await i(t,[...n]);else if(a)e=await a(t);else return{message:`image generation isn't available`};return ye(e)?e:{message:`image generation returned an unrecognized result`}}catch(e){return{message:`image generation failed: ${e instanceof Error?e.message:String(e)}`}}}var Ce=50;function K(e){let t=new Map;return n=>{let r=n.conversationId??``,i=t.get(r);if(i===void 0?i=e():t.delete(r),t.set(r,i),t.size>Ce){let e=t.keys().next().value;e!==void 0&&t.delete(e)}return i}}var q=`slide-md`,we=`
206
206
  .${q} { box-sizing: border-box; flex-shrink: 0; width: ${t}px; height: 720px; padding: 56px 80px; overflow: hidden; display: flex; flex-direction: column; justify-content: center; gap: 0.5em; background: #ffffff; color: #0f172a; font-family: ui-sans-serif, system-ui, sans-serif; line-height: 1.35; }
207
207
  .${q} > * { margin: 0; }
208
208
  .${q} h1 { font-size: 1.9em; font-weight: 800; color: #1e3a8a; line-height: 1.15; }
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./core-BsHwn1O3.cjs");exports.DEFINE_STORYBOARD=e.c,exports.DEFINE_STORYBOARD_DEFINITION=e.l,exports.MAX_CHARACTERS=e.u,exports.MAX_CHOICES=e.d,exports.MAX_PANELS=e.f,exports.MAX_SLIDE_HTML=e.N,exports.PANEL_ARGS_ERROR=e.p,exports.PRESENT_PANEL=e.m,exports.PRESENT_PANEL_DEFINITION=e.h,exports.PRESENT_SLIDE=e.g,exports.PRESENT_SLIDE_DEFINITION=e._,exports.PRESENT_SLIDE_PROMPT=e.v,exports.SEQUENCE_ID=e.y,exports.SLIDESHOWS_DIR=e.i,exports.SLIDE_ANIMATION_KINDS=e.P,exports.SLIDE_ARGS_ERROR=e.b,exports.SLIDE_AUTO_END_SECONDS=e.F,exports.SLIDE_CHART_INVALID=e.x,exports.SLIDE_CHART_TYPES=e.j,exports.SLIDE_CSS_ANIMATIONS_FINISHED=e.I,exports.SLIDE_FIT_SCRIPT=e.L,exports.SLIDE_HEIGHT=e.R,exports.SLIDE_HTML_TOO_LONG=e.S,exports.SLIDE_WIDTH=e.z,exports.STORYBOARDS_DIR=e.a,exports.STORYBOARD_PROMPT=e.C,exports.castShownInstructions=e.w,exports.chartSlideDocument=e.M,exports.defineStoryboardPluginCore=e.t,exports.loadRecord=e.o,exports.markdownSlideHtml=e.s,exports.panelShownInstructions=e.T,exports.parsePanelArgs=e.E,exports.parseSlideArgs=e.D,exports.parseStoryboardArgs=e.O,exports.presentPanelPluginCore=e.n,exports.presentSlidePluginCore=e.r,exports.sameName=e.k,exports.slideHtmlDocument=e.B,exports.slideShownInstructions=e.A;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./core-DlvNLaFp.cjs");exports.DEFINE_STORYBOARD=e.c,exports.DEFINE_STORYBOARD_DEFINITION=e.l,exports.MAX_CHARACTERS=e.u,exports.MAX_CHOICES=e.d,exports.MAX_PANELS=e.f,exports.MAX_SLIDE_HTML=e.N,exports.PANEL_ARGS_ERROR=e.p,exports.PRESENT_PANEL=e.m,exports.PRESENT_PANEL_DEFINITION=e.h,exports.PRESENT_SLIDE=e.g,exports.PRESENT_SLIDE_DEFINITION=e._,exports.PRESENT_SLIDE_PROMPT=e.v,exports.SEQUENCE_ID=e.y,exports.SLIDESHOWS_DIR=e.i,exports.SLIDE_ANIMATION_KINDS=e.P,exports.SLIDE_ARGS_ERROR=e.b,exports.SLIDE_AUTO_END_SECONDS=e.F,exports.SLIDE_CHART_INVALID=e.x,exports.SLIDE_CHART_TYPES=e.j,exports.SLIDE_CSS_ANIMATIONS_FINISHED=e.I,exports.SLIDE_FIT_SCRIPT=e.L,exports.SLIDE_HEIGHT=e.R,exports.SLIDE_HTML_TOO_LONG=e.S,exports.SLIDE_WIDTH=e.z,exports.STORYBOARDS_DIR=e.a,exports.STORYBOARD_PROMPT=e.C,exports.castShownInstructions=e.w,exports.chartSlideDocument=e.M,exports.defineStoryboardPluginCore=e.t,exports.loadRecord=e.o,exports.markdownSlideHtml=e.s,exports.panelShownInstructions=e.T,exports.parsePanelArgs=e.E,exports.parseSlideArgs=e.D,exports.parseStoryboardArgs=e.O,exports.presentPanelPluginCore=e.n,exports.presentSlidePluginCore=e.r,exports.sameName=e.k,exports.slideHtmlDocument=e.B,exports.slideShownInstructions=e.A;
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { A as e, B as t, C as n, D as r, E as i, F as a, I as o, L as s, M as c, N as l, O as u, P as d, R as f, S as p, T as m, _ as h, a as g, b as _, c as v, d as y, f as b, g as x, h as S, i as C, j as w, k as T, l as E, m as D, n as O, o as k, p as A, r as j, s as M, t as N, u as P, v as F, w as I, x as L, y as R, z } from "./core-BsZHVy5S.js";
1
+ import { A as e, B as t, C as n, D as r, E as i, F as a, I as o, L as s, M as c, N as l, O as u, P as d, R as f, S as p, T as m, _ as h, a as g, b as _, c as v, d as y, f as b, g as x, h as S, i as C, j as w, k as T, l as E, m as D, n as O, o as k, p as A, r as j, s as M, t as N, u as P, v as F, w as I, x as L, y as R, z } from "./core-BYk8F8Fi.js";
2
2
  export { v as DEFINE_STORYBOARD, E as DEFINE_STORYBOARD_DEFINITION, P as MAX_CHARACTERS, y as MAX_CHOICES, b as MAX_PANELS, l as MAX_SLIDE_HTML, A as PANEL_ARGS_ERROR, D as PRESENT_PANEL, S as PRESENT_PANEL_DEFINITION, x as PRESENT_SLIDE, h as PRESENT_SLIDE_DEFINITION, F as PRESENT_SLIDE_PROMPT, R as SEQUENCE_ID, C as SLIDESHOWS_DIR, d as SLIDE_ANIMATION_KINDS, _ as SLIDE_ARGS_ERROR, a as SLIDE_AUTO_END_SECONDS, L as SLIDE_CHART_INVALID, w as SLIDE_CHART_TYPES, o as SLIDE_CSS_ANIMATIONS_FINISHED, s as SLIDE_FIT_SCRIPT, f as SLIDE_HEIGHT, p as SLIDE_HTML_TOO_LONG, z as SLIDE_WIDTH, g as STORYBOARDS_DIR, n as STORYBOARD_PROMPT, I as castShownInstructions, c as chartSlideDocument, N as defineStoryboardPluginCore, k as loadRecord, M as markdownSlideHtml, m as panelShownInstructions, i as parsePanelArgs, r as parseSlideArgs, u as parseStoryboardArgs, O as presentPanelPluginCore, j as presentSlidePluginCore, T as sameName, t as slideHtmlDocument, e as slideShownInstructions };
package/dist/vue.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./core-BsHwn1O3.cjs");let t=require("vue"),n=require("@mulmochat-plugin/ui-image");function r({caption:e,choices:n}){let r=[];return e&&r.push((0,t.h)(`p`,{class:`text-center text-lg text-gray-800 px-4`},e)),n?.length&&r.push((0,t.h)(`ol`,{class:`flex flex-wrap justify-center gap-3 px-4`},n.map((e,n)=>(0,t.h)(`li`,{class:`rounded-full bg-indigo-600 text-white text-xl px-5 py-2 font-medium`},`${n+1}. ${e}`)))),r.length?(0,t.h)(`div`,{class:`flex flex-col gap-2 pb-2`},r):null}function i(e,n=()=>({})){return(0,t.markRaw)((0,t.defineComponent)({name:e,props:{selectedResult:{type:Object,required:!0}},setup(e){return()=>{let i=e.selectedResult.data;return i?.imageData?(0,t.h)(`div`,{class:`h-full w-full flex flex-col bg-white p-2 gap-2`},[(0,t.h)(`div`,{class:`flex-1 min-h-0 flex items-center justify-center`},[(0,t.h)(`img`,{src:i.imageData,alt:i.prompt??``,class:`max-w-full max-h-full object-contain`})]),r(n(i))]):(0,t.h)(`div`,{class:`h-full bg-white`})}}}))}var a=(0,t.defineComponent)({name:`SlidePage`,props:{page:{type:String,required:!0}},setup(n){let r=(0,t.ref)(null),i=(0,t.ref)(0),a,o=()=>{let t=r.value;t&&(i.value=Math.min(t.clientWidth/e.z,t.clientHeight/720))};return(0,t.onMounted)(()=>{o(),a=new ResizeObserver(o),r.value&&a.observe(r.value)}),(0,t.onBeforeUnmount)(()=>a?.disconnect()),()=>(0,t.h)(`div`,{ref:r,class:`flex-1 min-h-0 w-full relative overflow-hidden`},i.value>0?[(0,t.h)(`iframe`,{srcdoc:n.page,sandbox:`allow-scripts`,title:`slide`,width:e.z,height:720,class:`absolute border-0 bg-white shadow`,style:{left:`50%`,top:`50%`,transform:`translate(-50%, -50%) scale(${i.value})`}})]:[])}}),o=i(`PresentSlideImageView`),s=(0,t.markRaw)((0,t.defineComponent)({name:`PresentSlideView`,props:{selectedResult:{type:Object,required:!0}},setup(n){return()=>{let r=n.selectedResult.data,i=r?.html?e.B(r.html):r?.chart?e.M(r.title,r.chart):``;return i?(0,t.h)(`div`,{class:`h-full w-full flex flex-col bg-slate-100 p-2`},[(0,t.h)(a,{key:n.selectedResult.uuid??i,page:i})]):(0,t.h)(o,{selectedResult:n.selectedResult})}}})),c=(0,t.markRaw)((0,t.defineComponent)({name:`PresentSlidePreview`,props:{result:{type:Object,required:!0}},setup(e){return()=>{let r=e.result.data;return!r?.html&&!r?.chart?(0,t.h)(n.ImagePreview,{result:e.result}):(0,t.h)(`div`,{class:`aspect-video w-full rounded bg-gradient-to-br from-indigo-600 to-sky-500 text-white flex flex-col items-center justify-center p-2 text-center`},[(0,t.h)(`div`,{class:`text-xs opacity-80`},`Slide ${r.slide} of ${r.totalSlides}`),(0,t.h)(`div`,{class:`text-sm font-semibold leading-tight line-clamp-2`},r.title||e.result.title||``)])}}}));function l(e){return(0,t.markRaw)((0,t.defineComponent)({name:e,props:{result:{type:Object,required:!0}},setup(e){return()=>(0,t.h)(n.ImagePreview,{result:e.result})}}))}var u=(0,t.markRaw)((0,t.defineComponent)({name:`StoryboardCastView`,props:{selectedResult:{type:Object,required:!0}},setup(e){return()=>{let n=e.selectedResult.data,r=n?.characters??[];return(0,t.h)(`div`,{class:`h-full w-full flex flex-col bg-white p-4`},[(0,t.h)(`h2`,{class:`text-center text-xl font-semibold text-gray-800 mb-3`},n?.title??``),(0,t.h)(`div`,{class:`flex-1 min-h-0 grid gap-3 ${r.length>1?`grid-cols-2`:`grid-cols-1`} auto-rows-fr`},r.map(e=>(0,t.h)(`figure`,{class:`min-h-0 flex flex-col items-center`},[e.imageData?(0,t.h)(`img`,{src:e.imageData,alt:e.name,class:`flex-1 min-h-0 max-w-full object-contain`}):(0,t.h)(`div`,{class:`flex-1`}),(0,t.h)(`figcaption`,{class:`text-lg text-gray-800 mt-1`},e.name)])))])}}})),d=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[],f={...e.r,viewComponent:s,previewComponent:c},p={...e.t,viewComponent:u,previewComponent:l(`StoryboardCastPreview`)},m={...e.n,viewComponent:i(`PresentPanelView`,e=>({caption:typeof e.caption==`string`?e.caption:``,choices:d(e.choices)})),previewComponent:l(`PresentPanelPreview`)},h=[f,p,m];exports.DEFINE_STORYBOARD=e.c,exports.DEFINE_STORYBOARD_DEFINITION=e.l,exports.MAX_CHARACTERS=e.u,exports.MAX_CHOICES=e.d,exports.MAX_PANELS=e.f,exports.MAX_SLIDE_HTML=e.N,exports.PANEL_ARGS_ERROR=e.p,exports.PRESENT_PANEL=e.m,exports.PRESENT_PANEL_DEFINITION=e.h,exports.PRESENT_SLIDE=e.g,exports.PRESENT_SLIDE_DEFINITION=e._,exports.PRESENT_SLIDE_PROMPT=e.v,exports.SEQUENCE_ID=e.y,exports.SLIDESHOWS_DIR=e.i,exports.SLIDE_ANIMATION_KINDS=e.P,exports.SLIDE_ARGS_ERROR=e.b,exports.SLIDE_AUTO_END_SECONDS=e.F,exports.SLIDE_CHART_INVALID=e.x,exports.SLIDE_CHART_TYPES=e.j,exports.SLIDE_CSS_ANIMATIONS_FINISHED=e.I,exports.SLIDE_FIT_SCRIPT=e.L,exports.SLIDE_HEIGHT=e.R,exports.SLIDE_HTML_TOO_LONG=e.S,exports.SLIDE_WIDTH=e.z,exports.STORYBOARDS_DIR=e.a,exports.STORYBOARD_PROMPT=e.C,exports.castShownInstructions=e.w,exports.chartSlideDocument=e.M,exports.defineStoryboardPlugin=p,exports.defineStoryboardPluginCore=e.t,exports.loadRecord=e.o,exports.markdownSlideHtml=e.s,exports.panelShownInstructions=e.T,exports.parsePanelArgs=e.E,exports.parseSlideArgs=e.D,exports.parseStoryboardArgs=e.O,exports.plugins=h,exports.presentPanelPlugin=m,exports.presentPanelPluginCore=e.n,exports.presentSlidePlugin=f,exports.presentSlidePluginCore=e.r,exports.sameName=e.k,exports.slideHtmlDocument=e.B,exports.slideShownInstructions=e.A;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./core-DlvNLaFp.cjs");let t=require("vue"),n=require("@mulmochat-plugin/ui-image");function r({caption:e,choices:n}){let r=[];return e&&r.push((0,t.h)(`p`,{class:`text-center text-lg text-gray-800 px-4`},e)),n?.length&&r.push((0,t.h)(`ol`,{class:`flex flex-wrap justify-center gap-3 px-4`},n.map((e,n)=>(0,t.h)(`li`,{class:`rounded-full bg-indigo-600 text-white text-xl px-5 py-2 font-medium`},`${n+1}. ${e}`)))),r.length?(0,t.h)(`div`,{class:`flex flex-col gap-2 pb-2`},r):null}function i(e,n=()=>({})){return(0,t.markRaw)((0,t.defineComponent)({name:e,props:{selectedResult:{type:Object,required:!0}},setup(e){return()=>{let i=e.selectedResult.data;return i?.imageData?(0,t.h)(`div`,{class:`h-full w-full flex flex-col bg-white p-2 gap-2`},[(0,t.h)(`div`,{class:`flex-1 min-h-0 flex items-center justify-center`},[(0,t.h)(`img`,{src:i.imageData,alt:i.prompt??``,class:`max-w-full max-h-full object-contain`})]),r(n(i))]):(0,t.h)(`div`,{class:`h-full bg-white`})}}}))}var a=(0,t.defineComponent)({name:`SlidePage`,props:{page:{type:String,required:!0}},setup(n){let r=(0,t.ref)(null),i=(0,t.ref)(0),a,o=()=>{let t=r.value;t&&(i.value=Math.min(t.clientWidth/e.z,t.clientHeight/720))};return(0,t.onMounted)(()=>{o(),a=new ResizeObserver(o),r.value&&a.observe(r.value)}),(0,t.onBeforeUnmount)(()=>a?.disconnect()),()=>(0,t.h)(`div`,{ref:r,class:`flex-1 min-h-0 w-full relative overflow-hidden`},i.value>0?[(0,t.h)(`iframe`,{srcdoc:n.page,sandbox:`allow-scripts`,title:`slide`,width:e.z,height:720,class:`absolute border-0 bg-white shadow`,style:{left:`50%`,top:`50%`,transform:`translate(-50%, -50%) scale(${i.value})`}})]:[])}}),o=i(`PresentSlideImageView`),s=(0,t.markRaw)((0,t.defineComponent)({name:`PresentSlideView`,props:{selectedResult:{type:Object,required:!0}},setup(n){return()=>{let r=n.selectedResult.data,i=r?.html?e.B(r.html):r?.chart?e.M(r.title,r.chart):``;return i?(0,t.h)(`div`,{class:`h-full w-full flex flex-col bg-slate-100 p-2`},[(0,t.h)(a,{key:n.selectedResult.uuid??i,page:i})]):(0,t.h)(o,{selectedResult:n.selectedResult})}}})),c=(0,t.markRaw)((0,t.defineComponent)({name:`PresentSlidePreview`,props:{result:{type:Object,required:!0}},setup(e){return()=>{let r=e.result.data;return!r?.html&&!r?.chart?(0,t.h)(n.ImagePreview,{result:e.result}):(0,t.h)(`div`,{class:`aspect-video w-full rounded bg-gradient-to-br from-indigo-600 to-sky-500 text-white flex flex-col items-center justify-center p-2 text-center`},[(0,t.h)(`div`,{class:`text-xs opacity-80`},`Slide ${r.slide} of ${r.totalSlides}`),(0,t.h)(`div`,{class:`text-sm font-semibold leading-tight line-clamp-2`},r.title||e.result.title||``)])}}}));function l(e){return(0,t.markRaw)((0,t.defineComponent)({name:e,props:{result:{type:Object,required:!0}},setup(e){return()=>(0,t.h)(n.ImagePreview,{result:e.result})}}))}var u=(0,t.markRaw)((0,t.defineComponent)({name:`StoryboardCastView`,props:{selectedResult:{type:Object,required:!0}},setup(e){return()=>{let n=e.selectedResult.data,r=n?.characters??[];return(0,t.h)(`div`,{class:`h-full w-full flex flex-col bg-white p-4`},[(0,t.h)(`h2`,{class:`text-center text-xl font-semibold text-gray-800 mb-3`},n?.title??``),(0,t.h)(`div`,{class:`flex-1 min-h-0 grid gap-3 ${r.length>1?`grid-cols-2`:`grid-cols-1`} auto-rows-fr`},r.map(e=>(0,t.h)(`figure`,{class:`min-h-0 flex flex-col items-center`},[e.imageData?(0,t.h)(`img`,{src:e.imageData,alt:e.name,class:`flex-1 min-h-0 max-w-full object-contain`}):(0,t.h)(`div`,{class:`flex-1`}),(0,t.h)(`figcaption`,{class:`text-lg text-gray-800 mt-1`},e.name)])))])}}})),d=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[],f={...e.r,viewComponent:s,previewComponent:c},p={...e.t,viewComponent:u,previewComponent:l(`StoryboardCastPreview`)},m={...e.n,viewComponent:i(`PresentPanelView`,e=>({caption:typeof e.caption==`string`?e.caption:``,choices:d(e.choices)})),previewComponent:l(`PresentPanelPreview`)},h=[f,p,m];exports.DEFINE_STORYBOARD=e.c,exports.DEFINE_STORYBOARD_DEFINITION=e.l,exports.MAX_CHARACTERS=e.u,exports.MAX_CHOICES=e.d,exports.MAX_PANELS=e.f,exports.MAX_SLIDE_HTML=e.N,exports.PANEL_ARGS_ERROR=e.p,exports.PRESENT_PANEL=e.m,exports.PRESENT_PANEL_DEFINITION=e.h,exports.PRESENT_SLIDE=e.g,exports.PRESENT_SLIDE_DEFINITION=e._,exports.PRESENT_SLIDE_PROMPT=e.v,exports.SEQUENCE_ID=e.y,exports.SLIDESHOWS_DIR=e.i,exports.SLIDE_ANIMATION_KINDS=e.P,exports.SLIDE_ARGS_ERROR=e.b,exports.SLIDE_AUTO_END_SECONDS=e.F,exports.SLIDE_CHART_INVALID=e.x,exports.SLIDE_CHART_TYPES=e.j,exports.SLIDE_CSS_ANIMATIONS_FINISHED=e.I,exports.SLIDE_FIT_SCRIPT=e.L,exports.SLIDE_HEIGHT=e.R,exports.SLIDE_HTML_TOO_LONG=e.S,exports.SLIDE_WIDTH=e.z,exports.STORYBOARDS_DIR=e.a,exports.STORYBOARD_PROMPT=e.C,exports.castShownInstructions=e.w,exports.chartSlideDocument=e.M,exports.defineStoryboardPlugin=p,exports.defineStoryboardPluginCore=e.t,exports.loadRecord=e.o,exports.markdownSlideHtml=e.s,exports.panelShownInstructions=e.T,exports.parsePanelArgs=e.E,exports.parseSlideArgs=e.D,exports.parseStoryboardArgs=e.O,exports.plugins=h,exports.presentPanelPlugin=m,exports.presentPanelPluginCore=e.n,exports.presentSlidePlugin=f,exports.presentSlidePluginCore=e.r,exports.sameName=e.k,exports.slideHtmlDocument=e.B,exports.slideShownInstructions=e.A;
package/dist/vue.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as e, B as t, C as n, D as r, E as i, F as a, I as o, L as s, M as c, N as l, O as u, P as d, R as f, S as p, T as m, _ as h, a as g, b as _, c as v, d as ee, f as te, g as ne, h as y, i as b, j as x, k as S, l as C, m as w, n as T, o as E, p as D, r as O, s as k, t as A, u as j, v as M, w as N, x as re, y as P, z as F } from "./core-BsZHVy5S.js";
1
+ import { A as e, B as t, C as n, D as r, E as i, F as a, I as o, L as s, M as c, N as l, O as u, P as d, R as f, S as p, T as m, _ as h, a as g, b as _, c as v, d as ee, f as te, g as ne, h as y, i as b, j as x, k as S, l as C, m as w, n as T, o as E, p as D, r as O, s as k, t as A, u as j, v as M, w as N, x as re, y as P, z as F } from "./core-BYk8F8Fi.js";
2
2
  import { defineComponent as I, h as L, markRaw as R, onBeforeUnmount as z, onMounted as B, ref as V } from "vue";
3
3
  import { ImagePreview as H } from "@mulmochat-plugin/ui-image";
4
4
  //#region src/vue/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gui-chat-plugin/sequence",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "description": "Slideshows, step-by-step guides and stories told in pictures (presentSlide, defineStoryboard, presentPanel) for GUI Chat Protocol hosts",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",