@engenty/wizards 0.8.0 → 0.9.1

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.
@@ -20,7 +20,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
22
22
 
23
- The built package (dist/) also contains these modules of @engenty-wizards/shared,
23
+ The built package (dist/) also contains these modules of @engenty/wizards-shared,
24
24
  which are under FSL-1.1-MIT OR MIT (packages/shared/LICENSE-MIT) and are included
25
25
  here under the MIT licence above: definition, fit, run, store, surface and
26
26
  engenty/data-tables/columns, columns-format.
@@ -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
  }
@@ -525,6 +534,7 @@ declare const NOTES_EN: {
525
534
  readonly other: "A page can have at most {count} characters.";
526
535
  };
527
536
  readonly chooseFileUpTo: "Choose a file of {mb} MB or less.";
537
+ readonly fontSourceNoFont: "{family} needs a font file of the space: choose a .woff2 from the assets.";
528
538
  readonly roomMostFiles: {
529
539
  readonly one: "There’s room for at most {count} file here.";
530
540
  readonly other: "There’s room for at most {count} files here.";
@@ -577,6 +587,14 @@ declare interface RunEvent {
577
587
  asset?: string | null;
578
588
  }
579
589
 
590
+ /** A brand font as a run page loads it: from our copy of its file, or from the space's website. */
591
+ declare interface RunFontFace {
592
+ family: string;
593
+ /** Ours (`/api/public/fonts/…`) or the website's: the font file or a stylesheet that holds it. */
594
+ url: string;
595
+ stylesheet: boolean;
596
+ }
597
+
580
598
  /** A line of `RUN_NOTES` with what goes into its gaps. */
581
599
  declare interface RunNote {
582
600
  code: RunNoteCode;
@@ -606,7 +624,10 @@ declare interface RunSource {
606
624
 
607
625
  declare type RunStatus = "waiting_input" | "running" | "done" | "failed" | "cancelled";
608
626
 
609
- /** How a wizard's pages look, taken from its space's brand (`runTheme`). Null: the runner's own. */
627
+ /**
628
+ * How a wizard's pages look: its space's brand (`runTheme`) with the wizard's own style on top
629
+ * (`themedLook`). Null: the runner's own.
630
+ */
610
631
  declare interface RunTheme {
611
632
  /** Buttons and marks. */
612
633
  accent: string | null;
@@ -617,8 +638,22 @@ declare interface RunTheme {
617
638
  /** Typefaces as CSS names them. */
618
639
  display: string | null;
619
640
  body: string | null;
641
+ /** The brand fonts of the two typefaces that have a source: the page loads them from there. */
642
+ faces: RunFontFace[];
620
643
  /** The brand stands on a dark ground. */
621
644
  dark: boolean;
645
+ /** The theme has only dark or only light pages: the person's own setting does not change it. */
646
+ pinned: boolean;
647
+ /** The theme's colours for light and for dark pages; the page takes those of what it shows. */
648
+ modes: {
649
+ light: ThemeColours | null;
650
+ dark: ThemeColours | null;
651
+ } | null;
652
+ /** Which of the two the pages show while the person has not chosen. */
653
+ prefer: "light" | "dark" | null;
654
+ shape: ThemeShape | null;
655
+ /** Effects from the runner's library (`THEME_EFFECTS`); names it does not know are skipped. */
656
+ effects: ThemeEffect[];
622
657
  }
623
658
 
624
659
  /** How a run in the viewer's language shows. */
@@ -637,7 +672,7 @@ declare interface RunView {
637
672
  id: string;
638
673
  status: RunStatus;
639
674
  mode: "test" | "live";
640
- wizard: Pick<WizardDefinition, "title" | "description" | "avatar" | "intro">;
675
+ wizard: Pick<WizardDefinition, "title" | "description" | "avatar" | "costume" | "intro">;
641
676
  /** The language the wizard speaks, by its code: what is read aloud, and in which voice. */
642
677
  lang: string;
643
678
  /**
@@ -1621,6 +1656,39 @@ declare type TextShape = Named & {
1621
1656
  long?: boolean;
1622
1657
  };
1623
1658
 
1659
+ declare type ThemeColours = z.infer<typeof themeColoursSchema>;
1660
+
1661
+ declare const themeColoursSchema: z.ZodObject<{
1662
+ accent: z.ZodOptional<z.ZodString>;
1663
+ background: z.ZodOptional<z.ZodString>;
1664
+ text: z.ZodOptional<z.ZodString>;
1665
+ }, z.core.$strip>;
1666
+
1667
+ declare type ThemeEffect = z.infer<typeof themeEffectSchema>;
1668
+
1669
+ declare const themeEffectSchema: z.ZodObject<{
1670
+ id: z.ZodString;
1671
+ }, z.core.$catchall<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
1672
+
1673
+ declare type ThemeShape = z.infer<typeof themeShapeSchema>;
1674
+
1675
+ declare const themeShapeSchema: z.ZodObject<{
1676
+ radius: z.ZodOptional<z.ZodEnum<{
1677
+ round: "round";
1678
+ sharp: "sharp";
1679
+ soft: "soft";
1680
+ }>>;
1681
+ cards: z.ZodOptional<z.ZodEnum<{
1682
+ glass: "glass";
1683
+ outline: "outline";
1684
+ solid: "solid";
1685
+ }>>;
1686
+ headings: z.ZodOptional<z.ZodEnum<{
1687
+ normal: "normal";
1688
+ uppercase: "uppercase";
1689
+ }>>;
1690
+ }, z.core.$strip>;
1691
+
1624
1692
  /**
1625
1693
  * One run, live: the runtime's stream of the whole view, plus the commands a person gives. The
1626
1694
  * same as the studio's `useRun` (apps/web/src/runner/useRun.ts), on the runner's own client, so
@@ -1654,6 +1722,29 @@ export declare interface WizardInfo {
1654
1722
  fields: PublicField[];
1655
1723
  }
1656
1724
 
1725
+ /**
1726
+ * A theme's values as props for the runner's element: colours, fonts by family and the corner
1727
+ * radius as `--wizard-*` variables, how cards and headings look as data attributes, and of the
1728
+ * effects only those the host turns on and the card can draw. A brand font is named by its
1729
+ * family; the host loads it.
1730
+ */
1731
+ export declare function wizardLook(look: RunTheme, options?: WizardLookOptions): WizardLookProps;
1732
+
1733
+ export declare interface WizardLookOptions {
1734
+ /** Light or dark, as the host shows; else what the theme prefers. A theme with only one keeps it. */
1735
+ mode?: "light" | "dark";
1736
+ /** The effects the host turns on (`CARD_EFFECTS`); none unless given. */
1737
+ effects?: readonly string[];
1738
+ }
1739
+
1740
+ /** What goes on the element with `.engenty-runner`: CSS variables and data attributes. */
1741
+ export declare interface WizardLookProps {
1742
+ style: Record<string, string>;
1743
+ "data-cards"?: string;
1744
+ "data-headings"?: string;
1745
+ "data-effects"?: string;
1746
+ }
1747
+
1657
1748
  export declare type WizardProps = z.infer<typeof wizardProps>;
1658
1749
 
1659
1750
  export declare const wizardProps: z.ZodObject<{
@@ -1681,6 +1772,12 @@ declare const wizardSchema: z.ZodObject<{
1681
1772
  tower: "tower";
1682
1773
  wedge: "wedge";
1683
1774
  }>>;
1775
+ costume: z.ZodOptional<z.ZodEnum<{
1776
+ bat: "bat";
1777
+ devil: "devil";
1778
+ pumpkin: "pumpkin";
1779
+ witch: "witch";
1780
+ }>>;
1684
1781
  intro: z.ZodOptional<z.ZodString>;
1685
1782
  lang: z.ZodOptional<z.ZodString>;
1686
1783
  lists: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -1829,6 +1926,7 @@ declare const wizardSchema: z.ZodObject<{
1829
1926
  title: z.ZodOptional<z.ZodString>;
1830
1927
  description: z.ZodOptional<z.ZodString>;
1831
1928
  }, z.core.$strip>>>;
1929
+ themes: z.ZodOptional<z.ZodArray<z.ZodString>>;
1832
1930
  steps: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1833
1931
  id: z.ZodString;
1834
1932
  title: z.ZodString;
@@ -2510,6 +2608,16 @@ export declare interface WizardsConfig {
2510
2608
  lang?: Lang;
2511
2609
  /** The wizard's mascot above its pages; a plain dot in the wizard's colour unless given. */
2512
2610
  Mascot?: (props: MascotProps) => React.ReactNode;
2611
+ /**
2612
+ * The wizard's look here: `host` (your page's own `--wizard-*` variables, nothing of the
2613
+ * wizard's), `brand`, `default` or the id of a theme the wizard offers. Unless given, or one the
2614
+ * wizard does not offer: its first theme.
2615
+ */
2616
+ theme?: string;
2617
+ /** Light or dark, as your page shows; else what the theme prefers. */
2618
+ mode?: "light" | "dark";
2619
+ /** The effects of the wizard's theme the card may draw (`CARD_EFFECTS`); none unless given. */
2620
+ effects?: readonly string[];
2513
2621
  }
2514
2622
 
2515
2623
  /** The component as a prompt sees it: the same name and props, nothing to draw. */