@engenty/wizards 0.9.0 → 0.9.2

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.
@@ -52,6 +52,9 @@ declare interface BrandView {
52
52
  theme: RunTheme;
53
53
  }
54
54
 
55
+ /** The effects the wizard's card draws itself, when the host turns them on: CSS inside the card. */
56
+ export declare const CARD_EFFECTS: readonly ["glow", "pattern"];
57
+
55
58
  /** A choice drawn as a card, as the runner gets it. */
56
59
  declare interface CardOption {
57
60
  value: string;
@@ -132,6 +135,11 @@ declare interface ConnectorOption {
132
135
  hint?: string;
133
136
  }
134
137
 
138
+ /** The Halloween costumes a wizard's engenty can wear. Same list as the web app's engenty figures. */
139
+ declare const ENGENTY_COSTUMES: readonly ["witch", "devil", "bat", "pumpkin"];
140
+
141
+ declare type EngentyCostume = (typeof ENGENTY_COSTUMES)[number];
142
+
135
143
  declare type FieldShape = LeafShape | ListShape | ScoreShape | TableShape;
136
144
 
137
145
  declare type Format = (typeof FORMATS)[number];
@@ -211,6 +219,7 @@ declare interface LoginAsk extends AskBase {
211
219
 
212
220
  declare interface MascotProps {
213
221
  kind: string;
222
+ costume?: EngentyCostume;
214
223
  size?: number;
215
224
  fluffy?: boolean;
216
225
  }
@@ -324,6 +333,10 @@ declare const NOTES_EN: {
324
333
  readonly tryLater: "Try again later.";
325
334
  readonly recordingTooLarge: "The recording can be 10 MB at most.";
326
335
  readonly fileTooLarge: "Choose a file of {mb} MB or less.";
336
+ readonly uploadNotPicture: "This file isn’t a picture that can be read. Choose a PNG, JPEG, WebP or GIF.";
337
+ readonly uploadPictureTooLarge: "This picture is too large. Choose one of {mp} megapixels or less.";
338
+ readonly uploadNotItsType: "This file holds something other than its type says. Choose the file again.";
339
+ readonly uploadSvgNotUsable: "This SVG can’t be used. Save it again as a plain SVG, or choose a PNG.";
327
340
  readonly askClosed: "This question is no longer open.";
328
341
  readonly noBrowser: "The wizard has no browser open right now.";
329
342
  readonly notWaiting: "The wizard isn’t waiting for you right now.";
@@ -525,6 +538,7 @@ declare const NOTES_EN: {
525
538
  readonly other: "A page can have at most {count} characters.";
526
539
  };
527
540
  readonly chooseFileUpTo: "Choose a file of {mb} MB or less.";
541
+ readonly fontSourceNoFont: "{family} needs a font file of the space: choose a .woff2 from the assets.";
528
542
  readonly roomMostFiles: {
529
543
  readonly one: "There’s room for at most {count} file here.";
530
544
  readonly other: "There’s room for at most {count} files here.";
@@ -577,6 +591,14 @@ declare interface RunEvent {
577
591
  asset?: string | null;
578
592
  }
579
593
 
594
+ /** A brand font as a run page loads it: from our copy of its file, or from the space's website. */
595
+ declare interface RunFontFace {
596
+ family: string;
597
+ /** Ours (`/api/public/fonts/…`) or the website's: the font file or a stylesheet that holds it. */
598
+ url: string;
599
+ stylesheet: boolean;
600
+ }
601
+
580
602
  /** A line of `RUN_NOTES` with what goes into its gaps. */
581
603
  declare interface RunNote {
582
604
  code: RunNoteCode;
@@ -606,7 +628,10 @@ declare interface RunSource {
606
628
 
607
629
  declare type RunStatus = "waiting_input" | "running" | "done" | "failed" | "cancelled";
608
630
 
609
- /** How a wizard's pages look, taken from its space's brand (`runTheme`). Null: the runner's own. */
631
+ /**
632
+ * How a wizard's pages look: its space's brand (`runTheme`) with the wizard's own style on top
633
+ * (`themedLook`). Null: the runner's own.
634
+ */
610
635
  declare interface RunTheme {
611
636
  /** Buttons and marks. */
612
637
  accent: string | null;
@@ -617,8 +642,22 @@ declare interface RunTheme {
617
642
  /** Typefaces as CSS names them. */
618
643
  display: string | null;
619
644
  body: string | null;
645
+ /** The brand fonts of the two typefaces that have a source: the page loads them from there. */
646
+ faces: RunFontFace[];
620
647
  /** The brand stands on a dark ground. */
621
648
  dark: boolean;
649
+ /** The theme has only dark or only light pages: the person's own setting does not change it. */
650
+ pinned: boolean;
651
+ /** The theme's colours for light and for dark pages; the page takes those of what it shows. */
652
+ modes: {
653
+ light: ThemeColours | null;
654
+ dark: ThemeColours | null;
655
+ } | null;
656
+ /** Which of the two the pages show while the person has not chosen. */
657
+ prefer: "light" | "dark" | null;
658
+ shape: ThemeShape | null;
659
+ /** Effects from the runner's library (`THEME_EFFECTS`); names it does not know are skipped. */
660
+ effects: ThemeEffect[];
622
661
  }
623
662
 
624
663
  /** How a run in the viewer's language shows. */
@@ -637,7 +676,7 @@ declare interface RunView {
637
676
  id: string;
638
677
  status: RunStatus;
639
678
  mode: "test" | "live";
640
- wizard: Pick<WizardDefinition, "title" | "description" | "avatar" | "intro">;
679
+ wizard: Pick<WizardDefinition, "title" | "description" | "avatar" | "costume" | "intro">;
641
680
  /** The language the wizard speaks, by its code: what is read aloud, and in which voice. */
642
681
  lang: string;
643
682
  /**
@@ -1621,6 +1660,39 @@ declare type TextShape = Named & {
1621
1660
  long?: boolean;
1622
1661
  };
1623
1662
 
1663
+ declare type ThemeColours = z.infer<typeof themeColoursSchema>;
1664
+
1665
+ declare const themeColoursSchema: z.ZodObject<{
1666
+ accent: z.ZodOptional<z.ZodString>;
1667
+ background: z.ZodOptional<z.ZodString>;
1668
+ text: z.ZodOptional<z.ZodString>;
1669
+ }, z.core.$strip>;
1670
+
1671
+ declare type ThemeEffect = z.infer<typeof themeEffectSchema>;
1672
+
1673
+ declare const themeEffectSchema: z.ZodObject<{
1674
+ id: z.ZodString;
1675
+ }, z.core.$catchall<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
1676
+
1677
+ declare type ThemeShape = z.infer<typeof themeShapeSchema>;
1678
+
1679
+ declare const themeShapeSchema: z.ZodObject<{
1680
+ radius: z.ZodOptional<z.ZodEnum<{
1681
+ round: "round";
1682
+ sharp: "sharp";
1683
+ soft: "soft";
1684
+ }>>;
1685
+ cards: z.ZodOptional<z.ZodEnum<{
1686
+ glass: "glass";
1687
+ outline: "outline";
1688
+ solid: "solid";
1689
+ }>>;
1690
+ headings: z.ZodOptional<z.ZodEnum<{
1691
+ normal: "normal";
1692
+ uppercase: "uppercase";
1693
+ }>>;
1694
+ }, z.core.$strip>;
1695
+
1624
1696
  /**
1625
1697
  * One run, live: the runtime's stream of the whole view, plus the commands a person gives. The
1626
1698
  * same as the studio's `useRun` (apps/web/src/runner/useRun.ts), on the runner's own client, so
@@ -1654,6 +1726,29 @@ export declare interface WizardInfo {
1654
1726
  fields: PublicField[];
1655
1727
  }
1656
1728
 
1729
+ /**
1730
+ * A theme's values as props for the runner's element: colours, fonts by family and the corner
1731
+ * radius as `--wizard-*` variables, how cards and headings look as data attributes, and of the
1732
+ * effects only those the host turns on and the card can draw. A brand font is named by its
1733
+ * family; the host loads it.
1734
+ */
1735
+ export declare function wizardLook(look: RunTheme, options?: WizardLookOptions): WizardLookProps;
1736
+
1737
+ export declare interface WizardLookOptions {
1738
+ /** Light or dark, as the host shows; else what the theme prefers. A theme with only one keeps it. */
1739
+ mode?: "light" | "dark";
1740
+ /** The effects the host turns on (`CARD_EFFECTS`); none unless given. */
1741
+ effects?: readonly string[];
1742
+ }
1743
+
1744
+ /** What goes on the element with `.engenty-runner`: CSS variables and data attributes. */
1745
+ export declare interface WizardLookProps {
1746
+ style: Record<string, string>;
1747
+ "data-cards"?: string;
1748
+ "data-headings"?: string;
1749
+ "data-effects"?: string;
1750
+ }
1751
+
1657
1752
  export declare type WizardProps = z.infer<typeof wizardProps>;
1658
1753
 
1659
1754
  export declare const wizardProps: z.ZodObject<{
@@ -1681,6 +1776,12 @@ declare const wizardSchema: z.ZodObject<{
1681
1776
  tower: "tower";
1682
1777
  wedge: "wedge";
1683
1778
  }>>;
1779
+ costume: z.ZodOptional<z.ZodEnum<{
1780
+ bat: "bat";
1781
+ devil: "devil";
1782
+ pumpkin: "pumpkin";
1783
+ witch: "witch";
1784
+ }>>;
1684
1785
  intro: z.ZodOptional<z.ZodString>;
1685
1786
  lang: z.ZodOptional<z.ZodString>;
1686
1787
  lists: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -1829,6 +1930,7 @@ declare const wizardSchema: z.ZodObject<{
1829
1930
  title: z.ZodOptional<z.ZodString>;
1830
1931
  description: z.ZodOptional<z.ZodString>;
1831
1932
  }, z.core.$strip>>>;
1933
+ themes: z.ZodOptional<z.ZodArray<z.ZodString>>;
1832
1934
  steps: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1833
1935
  id: z.ZodString;
1834
1936
  title: z.ZodString;
@@ -2510,6 +2612,16 @@ export declare interface WizardsConfig {
2510
2612
  lang?: Lang;
2511
2613
  /** The wizard's mascot above its pages; a plain dot in the wizard's colour unless given. */
2512
2614
  Mascot?: (props: MascotProps) => React.ReactNode;
2615
+ /**
2616
+ * The wizard's look here: `host` (your page's own `--wizard-*` variables, nothing of the
2617
+ * wizard's), `brand`, `default` or the id of a theme the wizard offers. Unless given, or one the
2618
+ * wizard does not offer: its first theme.
2619
+ */
2620
+ theme?: string;
2621
+ /** Light or dark, as your page shows; else what the theme prefers. */
2622
+ mode?: "light" | "dark";
2623
+ /** The effects of the wizard's theme the card may draw (`CARD_EFFECTS`); none unless given. */
2624
+ effects?: readonly string[];
2513
2625
  }
2514
2626
 
2515
2627
  /** The component as a prompt sees it: the same name and props, nothing to draw. */