@hypersocial/decks-cli 0.9.23 → 0.9.25

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.
Files changed (91) hide show
  1. package/package.json +1 -1
  2. package/skills/hyperdecks/SKILL.md +124 -67
  3. package/skills/hyperdecks/chat.md +11 -8
  4. package/skills/hyperdecks/terminal.md +83 -0
  5. package/src/bars.mjs +268 -0
  6. package/src/brand.mjs +51 -8
  7. package/src/check.mjs +333 -20
  8. package/src/checkRules.mjs +677 -27
  9. package/src/commands.mjs +171 -31
  10. package/src/deckSlug.mjs +41 -0
  11. package/src/embedCapture.mjs +126 -0
  12. package/src/embedSources.mjs +252 -0
  13. package/src/embedsGuide.mjs +36 -0
  14. package/src/export-video.mjs +20 -3
  15. package/src/files.mjs +36 -0
  16. package/src/guide.mjs +93 -13
  17. package/src/hosted.mjs +18 -8
  18. package/src/iconAliasNames.mjs +70 -0
  19. package/src/iconChoice.mjs +97 -0
  20. package/src/iconSets.mjs +89 -0
  21. package/src/iconSlots.mjs +48 -0
  22. package/src/icons.mjs +285 -45
  23. package/src/iconsCli.mjs +76 -0
  24. package/src/layoutRoutes.mjs +97 -0
  25. package/src/layouts.mjs +9 -4
  26. package/src/mediaPreviews.mjs +3 -1
  27. package/src/narrate.mjs +31 -4
  28. package/src/opening.mjs +9 -3
  29. package/src/ops.mjs +125 -0
  30. package/src/photosGuide.mjs +47 -0
  31. package/src/picturesGuide.mjs +54 -0
  32. package/src/play.mjs +3 -2
  33. package/src/presenter.mjs +3 -1
  34. package/src/preview-capture.mjs +70 -1
  35. package/src/release.mjs +13 -5
  36. package/src/runtime.mjs +9 -2
  37. package/src/scaffold.mjs +73 -13
  38. package/src/source.mjs +86 -14
  39. package/src/stockMedia.mjs +299 -0
  40. package/src/themeCli.mjs +41 -0
  41. package/src/themes.mjs +345 -0
  42. package/templates/icons/material.LICENSE +202 -0
  43. package/templates/icons/material.json.gz +0 -0
  44. package/templates/icons/phosphor.LICENSE +21 -0
  45. package/templates/icons/phosphor.json.gz +0 -0
  46. package/templates/icons/tabler.LICENSE +21 -0
  47. package/templates/icons/tabler.json.gz +0 -0
  48. package/templates/layouts/_deck.html +231 -41
  49. package/templates/layouts/bento.html +76 -0
  50. package/templates/layouts/chart.html +6 -4
  51. package/templates/layouts/closer.html +13 -4
  52. package/templates/layouts/compare.html +13 -4
  53. package/templates/layouts/cover-band.html +13 -9
  54. package/templates/layouts/cover-frame.html +13 -7
  55. package/templates/layouts/cover-poster.html +9 -5
  56. package/templates/layouts/cover-split.html +19 -7
  57. package/templates/layouts/cover-type.html +2 -1
  58. package/templates/layouts/embed.html +93 -0
  59. package/templates/layouts/features.html +18 -10
  60. package/templates/layouts/funnel.html +62 -0
  61. package/templates/layouts/hero.html +41 -23
  62. package/templates/layouts/lanes.html +63 -0
  63. package/templates/layouts/loop.html +81 -0
  64. package/templates/layouts/number.html +3 -2
  65. package/templates/layouts/phone-stage.html +78 -0
  66. package/templates/layouts/phones.html +1 -0
  67. package/templates/layouts/picture-full.html +58 -0
  68. package/templates/layouts/portrait.html +53 -0
  69. package/templates/layouts/product.html +7 -6
  70. package/templates/layouts/quote.html +5 -3
  71. package/templates/layouts/rail.html +74 -0
  72. package/templates/layouts/scorecard.html +71 -0
  73. package/templates/layouts/screens.html +85 -0
  74. package/templates/layouts/sentence.html +39 -0
  75. package/templates/layouts/split.html +35 -7
  76. package/templates/layouts/spotlight.html +80 -0
  77. package/templates/layouts/stack.html +84 -0
  78. package/templates/layouts/staircase.html +78 -0
  79. package/templates/layouts/strike.html +46 -0
  80. package/templates/layouts/tap-through.html +73 -0
  81. package/templates/layouts/team.html +21 -6
  82. package/templates/layouts/timeline.html +21 -8
  83. package/templates/layouts/two-bars.html +53 -0
  84. package/templates/layouts/two-by-two.html +75 -0
  85. package/templates/layouts/video-beats.html +66 -0
  86. package/templates/layouts/video-full.html +62 -0
  87. package/templates/layouts/wall.html +109 -0
  88. package/templates/layouts/zoom.html +144 -0
  89. package/templates/narrated-deck.html +12 -7
  90. package/templates/script.md +2 -2
  91. /package/templates/icons/{LICENSE → lucide.LICENSE} +0 -0
package/src/themes.mjs ADDED
@@ -0,0 +1,345 @@
1
+ // The built-in themes: complete looks a deck can be made in (deck new --theme,
2
+ // new_deck { theme }, hyperdecks theme set). A theme is the tokens in the deck's
3
+ // `:root` (layouts/_deck.html): colours, fonts and title style, and the units every
4
+ // layout multiplies for its outlines, corners, shadows and tilt, plus the texture,
5
+ // the grounds, how photos are treated and how chart marks are drawn. House is the
6
+ // template's own look, value for value. Text in, text out (no I/O: the dashboard's
7
+ // client code and Convex import this), so the hosted MCP route and the CLI theme
8
+ // the same templates the same way.
9
+
10
+ // The units (layouts/_deck.html): a House outline of 4px is calc(4 * var(--line)), etc.
11
+ const HOUSE_SHAPE = { line: "1px", round: "1px", "round-phone": "1px", "drop-x": "1px", "drop-y": "1px", "drop-blur": "0px", "drop-mix": "100%", lift: "1px", "tilt-k": "1" };
12
+ const NO_SHADOW = { "drop-x": "0px", "drop-y": "0px", "drop-blur": "0px", "drop-mix": "0%" };
13
+ const HOUSE_REST = {
14
+ "display-style": "normal", "display-case": "none", "display-leading": ".95", "display-scale": "1",
15
+ "accent-ground": "var(--accent)", "ink-ground": "var(--ink)", texture: "none",
16
+ "photo-filter": "none", "photo-blend": "normal", "photo-mount": "0px", "photo-mount-foot": "0px", "photo-card": "none", "photo-mounted": "0", "photo-window": "0px", "photo-tilt": "none", "photo-tilt-2": "none", "photo-edge": "none",
17
+ // A screenshot or clip's mat (layouts/_deck.html): its thickness in the theme's card colour, 0px for none.
18
+ "shot-mat": "0px",
19
+ "bar-round": "10px", grid: "currentColor", "ink-text": "var(--paper)",
20
+ // A moving film over the player's stage, so over every slide (layouts/_deck.html, .hd-stage::after): off. film 1
21
+ // draws it; film-grain is its noise tile, film-dust a dust-and-scratch layer, film-flicker the dark wash under the grain at its deepest (an alpha; the light wavers between about half of it and all of it).
22
+ film: "0", "film-grain": "none", "film-dust": "none", "film-flicker": "0",
23
+ // The room's sound (the player's sound.js): a click as the slide changes and a faint whir while the narration plays,
24
+ // each its level as a gain (0 to 1): off. A deck turns Carousel's off by setting both to 0.
25
+ "projector-click": "0", "projector-whir": "0",
26
+ // A photo's caption (figure.mount[data-caption]): a plain label under the picture.
27
+ "caption-at": "static", "caption-gap": "10px", "caption-font": "var(--mono)", "caption-ink": "inherit", "caption-align": "start",
28
+ // The presenter's speech bubble on each ground, its ink, and how much of the ink its outline is (100%: a hard ink edge).
29
+ speech: "#f3c9dc", "speech-on-accent": "#ffffff", "speech-on-ink": "#d9ccff", "speech-on-tint": "#ffffff", "speech-ink": "#0b0b0f", "speech-edge": "100%",
30
+ // The player's buttons and end card (player.css's own values). The page around the card is the player's to colour.
31
+ "hd-ink": "#0b0b0f", "hd-paper": "#ffffff", "hd-accent": "#ffda1b",
32
+ // Icons (.icon in a layout's icon slot, layouts/_deck.html): an accent tile with an ink outline.
33
+ "icon-stroke": "2", "icon-tile": "var(--accent)", "icon-ink": "var(--accent-ink)", "icon-tile-accent": "var(--card)", "icon-ink-accent": "var(--ink)", "icon-pad": ".22", "icon-edge": "2",
34
+ // A duotone icon's second tone (Phosphor duotone; drawn at 20%): the icon's own colour, so it shows wherever the icon does.
35
+ "icon-duo": "currentColor",
36
+ // A bare theme's icon on a holder that paints its own light card (rail's dot, split's sticker): the card's ink. A tiled
37
+ // theme leaves it unset (initial: var() falls back to the tile's ink).
38
+ "icon-on-card": "initial",
39
+ // How much larger features' icon tile is drawn at the stage (1: the layout's 64px). Loud, whose titles are 84px
40
+ // capitals, draws it larger; the phone keeps the layout's size.
41
+ "icon-scale": "1",
42
+ };
43
+ // A bare icon: no tile, the colour of the text around it, at the theme's line weight; where a holder paints its own
44
+ // light card under it (rail's dot, split's sticker), the card's ink.
45
+ const BARE_ICON = (stroke) => ({ "icon-stroke": stroke, "icon-tile": "transparent", "icon-ink": "currentColor", "icon-tile-accent": "transparent", "icon-ink-accent": "currentColor", "icon-pad": ".1", "icon-edge": "0", "icon-duo": "currentColor", "icon-on-card": "var(--ink)" });
46
+ // A speech bubble in the theme's colours: light washes of its accents as hex (the player reads the fill as rgb to
47
+ // decide when to flip it), its ink a fixed dark so a brand that flips light and dark never loses it (contrast is tested).
48
+ const wash = (hex, p) => { const [x, y] = [hex, "#ffffff"].map((h) => [1, 3, 5].map((i) => parseInt(h.slice(i, i + 2), 16))); return `#${x.map((v, i) => Math.round(v * p + y[i] * (1 - p)).toString(16).padStart(2, "0")).join("")}`; };
49
+ const speechOf = (a, b, ink = "#0b0b0f") => ({ speech: wash(a, 0.38), "speech-on-accent": "#ffffff", "speech-on-ink": wash(b, 0.34), "speech-on-tint": "#ffffff", "speech-ink": ink });
50
+ // A projector's film grain (Carousel's film-grain): a 128px tile of light and dark specks, a seeded fractal noise drawn
51
+ // once as pixels (`node scripts/dev/film-grain-tile.mjs .45`: the prototype's strength A, the owner's pick; B was .75, C 1.15). Never the SVG
52
+ // filter itself: Chromium re-runs an SVG image's filter on every repaint, and the film repaints 16 times a second.
53
+ const FILM_GRAIN = `url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACABAMAAAAxEHz4AAAAMFBMVEX///////////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAxs2SiAAAAEHRSTlMABgsRFhwhJwAGCxEWHCEnBvC/GwAAFFhJREFUeNoteU1vXEmW3bkRj2XciMeem6TGQCZVRpAqGEiyuxFkyQYolYGnqvZC1T0Ap+1NTXtRtnf2Zrz3j4iXSS8yqTYiSc0iKdmIFGtDSjaepJ5FlQoDobs3MzULwTt75kc472MVoEIyP97Hveeee855wAoJFmYJpgJAMMyEkSc4HzEc4jgwIwDAxICwBYFFmxMKIbmIYKXDzQYJUmVTyjhDyBw9YQc7gtToT12NkZOrQgdpCItcgGJcntYIoJ/uhn0AxlXpGRD8hG6mP8kJGbgDmZ/AGdTYhwcGBeneUvICHGXHGJ8NAxh/AvKpARt687oyi2KPAb8t9kRww12+A0nG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mqqsTZmwA80Hi8jqBR9FPMGc2UQdpVfp9zqucPqXq2+RXbO1bOjtrtWay1F2NTH4yXSv7Lr03wBPkJKtRuXcW0A5+A/0G6LQ4JfygW0T56DnRbxC+3Mjb9D71VLLin5seFjcWf2UbXQ/gyDYBFwsnP/j/4X5OU4tVLTQAAAABJRU5ErkJggg==")`;
54
+ // Dust and a scratch (the prototype's option; on in Carousel, the owner's pick): a few specks, a hair and a faint
55
+ // vertical line on a layer twice the stage, drawn in its own percentages (layouts/_deck.html, @keyframes hd-film), so they land
56
+ // on the same spots of the picture at any stage size, somewhere new each step, or leave it.
57
+ export const FILM_DUST = `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25'%3E%3Cg fill='%23f3ead6' opacity='.55'%3E%3Ccircle cx='56.625%25' cy='57.778%25' r='2.2'/%3E%3Ccircle cx='90.938%25' cy='84.556%25' r='1.6'/%3E%3Cellipse cx='73.75%25' cy='72.778%25' rx='3' ry='1.2'/%3E%3Csvg x='81.938%25' y='54.444%25' overflow='visible'%3E%3Cpath d='M0 0 q6 40 -2 90' stroke='%23f3ead6' stroke-width='1.2' fill='none'/%3E%3C/svg%3E%3C/g%3E%3Cline x1='63.781%25' y1='50%25' x2='63.844%25' y2='100%25' stroke='%23f3ead6' stroke-opacity='.16' stroke-width='1.4'/%3E%3C/svg%3E")`;
58
+ // Carousel's card mount, a border-image: off-white card with a rounded window, its foot (the last 60 of the
59
+ // source's 120) deeper than its sides. The window's round corners sit in the corner slices; the picture's own
60
+ // rounded corners (--photo-window) let them show.
61
+ const CARD_MOUNT = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='120'%3E%3Cdefs%3E%3ClinearGradient id='p' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23f5f0e4'/%3E%3Cstop offset='1' stop-color='%23e6dcc8'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath fill='url(%23p)' fill-rule='evenodd' d='M2 0H88Q90 0 90 2V118Q90 120 88 120H2Q0 120 0 118V2Q0 0 2 0ZM30 18H60Q72 18 72 30V60Q72 72 60 72H30Q18 72 18 60V30Q18 18 30 18Z'/%3E%3Cpath fill='none' stroke='%23000' stroke-opacity='.16' d='M30 18H60Q72 18 72 30V60Q72 72 60 72H30Q18 72 18 60V30Q18 18 30 18Z'/%3E%3C/svg%3E";
62
+ const gf = (...families) => `https://fonts.googleapis.com/css2?${families.map((f) => `family=${f}`).join("&")}&display=swap`;
63
+
64
+ // colors: ink (text), paper (ground), accent, accent2, accent3, card; accentInk:
65
+ // which of ink and paper is the text on the accent ground. fonts: the stacks for
66
+ // --display, --font (body) and --mono, and the one Google Fonts stylesheet.
67
+ export const THEMES = [
68
+ {
69
+ id: "house", name: "House", for: "The template's own: bold outlines, hard shadows, a tilt. A startup demo, a product launch.",
70
+ colors: { ink: "#0b0b0f", paper: "#fafaf7", accent: "#ffda1b", accent2: "#27ceff", accent3: "#ff9ec7", card: "#ffffff" }, accentInk: "ink",
71
+ fonts: { display: null, body: '"Space Grotesk", system-ui, sans-serif', mono: '"Space Mono", ui-monospace, monospace', href: gf("Space+Grotesk:wght@500;700", "Space+Mono:wght@400;700") },
72
+ title: { weight: null, tracking: null },
73
+ tokens: { ...HOUSE_SHAPE, ...HOUSE_REST },
74
+ },
75
+ {
76
+ id: "longform", name: "Longform", for: "Essays, research, a founder's letter: italic serif titles, hairlines, square corners, no shadows.",
77
+ colors: { ink: "#10231c", paper: "#f3f6f4", accent: "#c9f24d", accent2: "#9cc9b4", accent3: "#b9d4c6", card: "#fbfcfb" }, accentInk: "ink",
78
+ fonts: { display: '"Fraunces", Georgia, serif', body: '"Inter", system-ui, sans-serif', mono: '"JetBrains Mono", ui-monospace, monospace', href: gf("Fraunces:ital,wght@0,500;1,500", "Inter:wght@400;500;600;700", "JetBrains+Mono:wght@400;700") },
79
+ title: { weight: "500", tracking: "-.03em" },
80
+ tokens: { ...HOUSE_SHAPE, ...NO_SHADOW, line: ".35px", round: "0px", "round-phone": ".75px", lift: "0px", "tilt-k": "0", ...HOUSE_REST, ...BARE_ICON("1.25"), ...speechOf("#c9f24d", "#9cc9b4", "#10231c"), "display-style": "italic", "display-leading": "1", "display-scale": "1.04", "accent-ground": "var(--tint-1)", "bar-round": "0px", grid: "var(--ink)" },
81
+ },
82
+ {
83
+ id: "blueprint", name: "Blueprint", for: "Developer tools, infrastructure, engineering: dark navy, a drafting grid, mono type, thin square lines.",
84
+ colors: { ink: "#dbe9ff", paper: "#0c1a3c", accent: "#5ee0ff", accent2: "#4c7dff", accent3: "#8fa8ff", card: "#12244f" }, accentInk: "paper",
85
+ fonts: { display: '"JetBrains Mono", ui-monospace, monospace', body: '"JetBrains Mono", ui-monospace, monospace', mono: '"JetBrains Mono", ui-monospace, monospace', href: gf("JetBrains+Mono:wght@400;500;600;700") },
86
+ title: { weight: "700", tracking: "-.05em" },
87
+ tokens: {
88
+ ...HOUSE_SHAPE, ...NO_SHADOW, line: ".5px", round: "0px", "round-phone": ".4px", lift: "0px", "tilt-k": "0", ...HOUSE_REST, ...BARE_ICON("1.5"), "icon-pad": ".2", "icon-edge": "2", ...speechOf("#5ee0ff", "#8fa8ff"), "display-leading": "1.02", "display-scale": ".82",
89
+ texture: "linear-gradient(color-mix(in srgb, var(--accent) 13%, transparent) 2px, transparent 2px) 0 0 / 64px 64px, linear-gradient(90deg, color-mix(in srgb, var(--accent) 13%, transparent) 2px, transparent 2px) 0 0 / 64px 64px",
90
+ "photo-filter": "grayscale(1) contrast(1.15)", "photo-blend": "screen", "bar-round": "0px", grid: "var(--accent)",
91
+ },
92
+ },
93
+ {
94
+ id: "soft", name: "Soft", for: "Friendly consumer apps, wellness, community: no outlines, big round corners, soft shadows, pastel grounds.",
95
+ colors: { ink: "#2a1f4d", paper: "#f1eaff", accent: "#ff8fb1", accent2: "#9be7c4", accent3: "#ffd37a", card: "#ffffff" }, accentInk: "ink",
96
+ fonts: { display: '"Bricolage Grotesque", system-ui, sans-serif', body: '"DM Sans", system-ui, sans-serif', mono: '"DM Mono", ui-monospace, monospace', href: gf("Bricolage+Grotesque:wght@500;800", "DM+Sans:wght@400;500;600;700", "DM+Mono:wght@400;500") },
97
+ title: { weight: "800", tracking: "-.04em" },
98
+ tokens: { ...HOUSE_SHAPE, line: "0px", round: "2.2px", "round-phone": "1.35px", "drop-x": "0px", "drop-y": ".55px", "drop-blur": "2.2px", "drop-mix": "22%", "tilt-k": ".6", ...HOUSE_REST, "icon-tile": "color-mix(in srgb, var(--accent) 70%, var(--card))", "icon-ink": "var(--ink)", "icon-pad": ".24", "icon-edge": "0", ...speechOf("#ff8fb1", "#9be7c4", "#2a1f4d"), "display-leading": ".98", texture: "radial-gradient(1000px 640px at 85% 0%, color-mix(in srgb, var(--card) 70%, transparent), transparent 70%)", "bar-round": "24px", "shot-mat": "11px" },
99
+ },
100
+ {
101
+ id: "loud", name: "Loud", for: "Launches, campaigns, culture and sport: huge condensed capitals, thick black rules, red and black, photos in black and white.",
102
+ colors: { ink: "#0a0a0a", paper: "#ffffff", accent: "#d92b12", accent2: "#ffe14d", accent3: "#0a0a0a", card: "#ffffff" }, accentInk: "paper",
103
+ fonts: { display: '"Anton", Impact, sans-serif', body: '"Inter", system-ui, sans-serif', mono: '"Inter", system-ui, sans-serif', href: gf("Anton", "Inter:wght@400;500;600;700;800") },
104
+ title: { weight: "400", tracking: "0" },
105
+ tokens: { ...HOUSE_SHAPE, ...NO_SHADOW, line: "1.75px", round: "0px", "round-phone": ".6px", lift: "0px", "tilt-k": "0", ...HOUSE_REST, "icon-stroke": "2.5", "icon-scale": "1.25", "icon-tile-accent": "var(--ink)", "icon-ink-accent": "var(--paper)", "icon-edge": "0", ...speechOf("#ffe14d", "#ffe14d"), "display-case": "uppercase", "display-leading": ".92", "display-scale": "1.1", "photo-filter": "grayscale(1) contrast(1.3)", "bar-round": "0px", grid: "var(--ink)" },
106
+ },
107
+ {
108
+ id: "print", name: "Print", for: "Studios, zines, events and makers: a risograph look, blue ink on pink paper, halftone, coloured offset shadows.",
109
+ colors: { ink: "#1d2bd6", paper: "#ffe9ec", accent: "#ffad9c", accent2: "#ffd400", accent3: "#7fe3c4", card: "#fff6f7" }, accentInk: "ink",
110
+ fonts: { display: '"Syne", system-ui, sans-serif', body: '"DM Sans", system-ui, sans-serif', mono: '"Space Mono", ui-monospace, monospace', href: gf("Syne:wght@700;800", "DM+Sans:wght@400;500;600;700", "Space+Mono:wght@400;700") },
111
+ title: { weight: "700", tracking: "-.06em" },
112
+ tokens: {
113
+ ...HOUSE_SHAPE, line: "1.25px", round: ".4px", "round-phone": ".95px", "drop-x": "1.3px", "drop-y": "1.3px", lift: "0px", "tilt-k": "-1.2", ...HOUSE_REST, ...BARE_ICON("2"), ...speechOf("#ffad9c", "#7fe3c4", "#1d2bd6"), "display-scale": ".92",
114
+ texture: "radial-gradient(color-mix(in srgb, currentColor 14%, transparent) 3.5px, transparent 4px) 0 0 / 22px 22px",
115
+ "photo-filter": "grayscale(1) contrast(1.25) brightness(1.15)", "photo-blend": "multiply", "bar-round": "4px", grid: "var(--ink)",
116
+ },
117
+ },
118
+ {
119
+ id: "quiet", name: "Quiet", for: "Finance, enterprise, board and investor updates: white, navy, fine lines, small corners, nothing tilted.",
120
+ colors: { ink: "#16202c", paper: "#ffffff", accent: "#1f4e8c", accent2: "#7aa6d6", accent3: "#c9d6e3", card: "#f6f8fa" }, accentInk: "paper",
121
+ fonts: { display: '"IBM Plex Sans", system-ui, sans-serif', body: '"IBM Plex Sans", system-ui, sans-serif', mono: '"IBM Plex Mono", ui-monospace, monospace', href: gf("IBM+Plex+Sans:wght@400;500;600;700", "IBM+Plex+Mono:wght@400;700") },
122
+ title: { weight: "600", tracking: "-.02em" },
123
+ tokens: { ...HOUSE_SHAPE, ...NO_SHADOW, line: ".35px", round: ".45px", "round-phone": ".8px", lift: ".6px", "tilt-k": "0", ...HOUSE_REST, ...BARE_ICON("1.5"), ...speechOf("#7aa6d6", "#c9d6e3", "#16202c"), "display-leading": "1", "display-scale": ".92", "bar-round": "2px", grid: "var(--ink)" },
124
+ },
125
+ {
126
+ id: "evening", name: "Evening", for: "Hospitality, food, fashion, culture, a story told after dark: warm dark grounds, a serif, an amber glow, soft corners.",
127
+ colors: { ink: "#f3ece2", paper: "#1d1815", accent: "#f0a35e", accent2: "#7fb7a4", accent3: "#e58e8e", card: "#2a2420" }, accentInk: "paper",
128
+ fonts: { display: '"Playfair Display", Georgia, serif', body: '"Source Sans 3", system-ui, sans-serif', mono: '"Source Code Pro", ui-monospace, monospace', href: gf("Playfair+Display:ital,wght@0,600;1,600", "Source+Sans+3:wght@400;500;600;700", "Source+Code+Pro:wght@400;700") },
129
+ title: { weight: "600", tracking: "-.01em" },
130
+ tokens: { ...HOUSE_SHAPE, line: "0px", round: "1.4px", "round-phone": "1.1px", "drop-x": "0px", "drop-y": ".6px", "drop-blur": "2.4px", "drop-mix": "45%", "tilt-k": ".5", ...HOUSE_REST, ...BARE_ICON("1.5"), ...speechOf("#f0a35e", "#7fb7a4", "#1d1815"), "display-leading": "1", texture: "radial-gradient(1200px 700px at 80% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%)", "bar-round": "8px", "shot-mat": "7px" },
131
+ },
132
+ {
133
+ id: "carousel", name: "Carousel", for: "Memories, travel, a family or company history, a talk told like an old slide show: a dark room, a projector's glow, pictures in white card mounts, typewriter titles.",
134
+ colors: { ink: "#efe6d2", paper: "#1a1714", accent: "#e9b949", accent2: "#c8734a", accent3: "#8fa98a", card: "#26211c" }, accentInk: "paper",
135
+ fonts: { display: '"Special Elite", "Courier New", monospace', body: '"Work Sans", system-ui, sans-serif', mono: '"Courier Prime", "Courier New", monospace', href: gf("Special+Elite", "Work+Sans:wght@400;500;600;700", "Courier+Prime:wght@400;700") },
136
+ title: { weight: "400", tracking: "-.01em" },
137
+ // Slides change like a projector's: a cut (script.md's transition).
138
+ transition: "cut",
139
+ tokens: {
140
+ ...HOUSE_SHAPE, ...NO_SHADOW, line: "0px", round: ".5px", "round-phone": ".9px", "drop-y": ".7px", "drop-blur": "1.6px", "drop-mix": "55%", lift: "1px", "tilt-k": ".35", ...HOUSE_REST, ...BARE_ICON("1.75"),
141
+ "display-leading": "1.05", "display-scale": ".84",
142
+ // The room: a projector's pool of light on the screen, falling off to the dark at its edges.
143
+ texture: "radial-gradient(62% 70% at 50% 46%, color-mix(in srgb, var(--accent) 9%, transparent) 0, transparent 72%), radial-gradient(125% 105% at 50% 46%, transparent 42%, rgba(0, 0, 0, .58) 100%)",
144
+ // Photos: film grain (an inline SVG filter, #hd-grain, applyTheme adds it), a warm fade and a soft shadow; framed ones
145
+ // sit in a thick card mount with rounded inner corners, a deeper foot and a tilt that alternates; edge-to-edge
146
+ // ones get soft projected edges instead.
147
+ "photo-filter": "url(#hd-grain) sepia(.3) saturate(.8) contrast(.92) brightness(1.05) drop-shadow(0 10px 14px rgba(0, 0, 0, .55))",
148
+ "photo-mount": "24px", "photo-mount-foot": "58px", "photo-card": `url("${CARD_MOUNT}") 30 30 60 30`, "photo-mounted": "1", "photo-window": "10px", "photo-tilt": "-1.5deg", "photo-tilt-2": "1deg",
149
+ "photo-edge": "radial-gradient(135% 125% at 50% 50%, #000 52%, transparent 100%)", "bar-round": "3px",
150
+ // The on-ink ground is the darkest (near-black), its text a fixed cream (a brand's ink may be dark); the wall's tile too.
151
+ "ink-ground": "#0c0a08", "ink-text": "#efe6d2",
152
+ "caption-at": "absolute", "caption-gap": "0px", "caption-font": '"Special Elite", "Courier New", monospace', "caption-ink": "#3b3227", "caption-align": "center",
153
+ speech: "#efe6d2", "speech-on-accent": "#efe6d2", "speech-on-ink": "#efe6d2", "speech-on-tint": "#efe6d2", "speech-ink": "#1f1a14", "speech-edge": "0%",
154
+ "hd-ink": "#1a1714", "hd-paper": "#efe6d2", "hd-accent": "var(--accent)",
155
+ // The projector: moving grain, dust and a scratch, and a faint flicker over the whole picture (the owner's pick on
156
+ // the prototype: strength A, subtle, with the dust and the scratch).
157
+ film: "1", "film-grain": FILM_GRAIN, "film-dust": FILM_DUST, "film-flicker": ".04",
158
+ // The projector's sound: the carousel clicking on to the next slide and a faint whir, about 25 dB under the
159
+ // narration (decks narrate near -20 LUFS; the whir file is -23.4 LUFS at 1). The owner picked both on
160
+ // the prototype (docs/roadmap/carousel-projector-sound-a-click-on-each-slide-change-and-a-.md): both, the quieter level.
161
+ "projector-click": ".2", "projector-whir": ".08",
162
+ },
163
+ },
164
+ ];
165
+
166
+ export const DEFAULT_THEME = "house";
167
+ export const THEME_IDS = THEMES.map((t) => t.id);
168
+
169
+ export function findTheme(name) {
170
+ const want = String(name ?? "").trim().toLowerCase();
171
+ return THEMES.find((t) => t.id === want) ?? null;
172
+ }
173
+
174
+ // The theme for a name, or a plain error listing them.
175
+ export function themeOrThrow(name) {
176
+ const theme = findTheme(name);
177
+ if (!theme) throw new Error(`unknown theme "${String(name ?? "").trim()}": pick one of ${THEME_IDS.join(", ")} (hyperdecks theme list)`);
178
+ return theme;
179
+ }
180
+
181
+ // script.md with the theme's slide change as the deck's transition (front matter), if it has one.
182
+ export function themeScript(script, name) {
183
+ const theme = name ? findTheme(name) : null;
184
+ if (!theme?.transition) return script;
185
+ return script.replace(/^(---\n[\s\S]*?)^transition:[^\n]*$/m, (_, head) => `${head}transition: ${theme.transition}`);
186
+ }
187
+
188
+ // The theme a deck says it is in (<html data-hd-theme>), or null for none (House by default).
189
+ export function deckTheme(html) {
190
+ return /<html\b[^>]*\sdata-hd-theme="([^"]*)"/i.exec(html)?.[1] ?? null;
191
+ }
192
+
193
+ // Every custom property a theme writes, name → value.
194
+ export function themeVars(theme) {
195
+ const c = theme.colors;
196
+ const vars = {
197
+ "--ink": c.ink, "--paper": c.paper, "--accent": c.accent, "--accent-2": c.accent2, "--accent-3": c.accent3, "--card": c.card,
198
+ "--accent-ink": theme.accentInk === "paper" ? "var(--paper)" : "var(--ink)",
199
+ "--font": theme.fonts.body, "--mono": theme.fonts.mono,
200
+ };
201
+ if (theme.fonts.display) vars["--display"] = theme.fonts.display;
202
+ if (theme.title.weight) vars["--display-weight"] = theme.title.weight;
203
+ if (theme.title.tracking) vars["--display-tracking"] = theme.title.tracking;
204
+ for (const [k, v] of Object.entries(theme.tokens)) vars[`--${k}`] = v;
205
+ return vars;
206
+ }
207
+
208
+ // A declaration's value in a `:root { … }` block's text: up to its `;` or `}`, past any quoted string (a data URL's
209
+ // `;base64`, as Carousel's film grain has, is inside the value).
210
+ export const CSS_VALUE = String.raw`(?:"[^"]*"|'[^']*'|[^;}"'])*`;
211
+ // Set (or add) one declaration in a `:root { … }` block's text.
212
+ export function setDecl(block, name, value) {
213
+ const decl = new RegExp(`((?:^|[\\s;{])${name.replace(/[-]/g, "\\-")}\\s*:\\s*)${CSS_VALUE}`);
214
+ return decl.test(block) ? block.replace(decl, (_, k) => `${k}${value}`) : block.replace(/\s*\}$/, (end) => ` ${name}: ${value};${end}`);
215
+ }
216
+ // Remove one declaration (a House deck has no --display etc.).
217
+ const dropDecl = (block, name) => block.replace(new RegExp(`\\s*${name.replace(/[-]/g, "\\-")}\\s*:${CSS_VALUE};`), "");
218
+
219
+ // Light, static film grain: monochrome noise in soft light over the picture (and its mount), kept to its shape.
220
+ export const GRAIN_SVG = '<svg class="hd-defs" width="0" height="0" aria-hidden="true" focusable="false" style="position:absolute"><filter id="hd-grain" x="-12%" y="-12%" width="124%" height="140%" color-interpolation-filters="sRGB"><feTurbulence type="fractalNoise" baseFrequency=".8" numOctaves="2" seed="4" stitchTiles="stitch" result="n"/><feColorMatrix in="n" type="saturate" values="0" result="m"/><feComponentTransfer in="m" result="g"><feFuncR type="linear" slope="1.25" intercept="-.12"/><feFuncG type="linear" slope="1.25" intercept="-.12"/><feFuncB type="linear" slope="1.25" intercept="-.12"/><feFuncA type="linear" slope="0" intercept="1"/></feComponentTransfer><feBlend in="g" in2="SourceGraphic" mode="soft-light" result="b"/><feComposite in="b" in2="SourceAlpha" operator="in"/></filter></svg>';
221
+
222
+ const ROOT = /:root\s*\{[^}]*--ink:[^}]*\}/;
223
+ const FONTS_LINK = /<link rel="stylesheet" href="https:\/\/fonts\.googleapis\.com\/css2\?[^"]*">\n?/g;
224
+
225
+ // index.html in a theme: its tokens written into the deck's :root (replaced or
226
+ // added), its fonts' stylesheet in place of the template's, and its name on
227
+ // <html data-hd-theme>. Applying another theme later swaps the same tokens.
228
+ // The brand goes on after (brand.mjs applyBrand recolours the theme).
229
+ // The film's rules (layouts/_deck.html, from its "hd-film {" marker to its "} hd-film" one): the film over the stage,
230
+ // where it holds still, and its steps. Its tokens alone draw nothing, so a theme that asks for the film brings these too:
231
+ // into a deck made before #316 (or from the narrated template, which has no film), or over an older copy of them.
232
+ const FILM_START = "/* hd-film {", FILM_END = "/* } hd-film */";
233
+ // #316's copy, which had no markers: from its comment to the end of its keyframes.
234
+ const FILM_316 = / \/\* The film \(--film: 1, Carousel's projector\)[\s\S]*?@keyframes hd-film \{[\s\S]*?\n \}\n/;
235
+ // The block itself, as layouts/_deck.html has it, character for character (lib/deckThemes.test.ts holds them together):
236
+ // a constant, so this module reads no file.
237
+ export const FILM_RULE = `/* hd-film { (applyTheme carries this block, to the closing marker, into a deck that lacks it or has an older one) */
238
+ /* The film (--film: 1, Carousel's projector): grain and a faint flicker over the whole picture, every slide, its text
239
+ and pictures included, never in the way of a tap. One layer over the player's stage (.hd-stage, which clips it; in scroll mode, where the stage is the
240
+ whole column, each slide carries its own),
241
+ above the slides and their transitions and under the presenter, who is in the room, not on the film; so it runs on
242
+ unbroken through slide changes, as a projector's does. One small tile of grain (pixels, never a filter) jumps
243
+ about in steps, 16 a second, which reads as film, over a faint dark wash that wavers with it (at most
244
+ --film-flicker deep). It is a layer of its own, so a step redraws only the film, never the slides. Both move on
245
+ the page clock, so a video export's clock places every step; the -3.7ms start keeps every step's
246
+ edge at least .4ms from a 24, 30 or 60 fps frame, where a rounding error could pick either side. No script.
247
+ It holds still (grain only: the dust rests off the picture, and no flicker) for reduced motion and in a thumbnail, and in a video export until the recording starts (the
248
+ player puts .hd-rolling on the body at the recorder's go), so it starts on the same frame in every export. */
249
+ @container style(--film: 1) {
250
+ body:not(.hd-scroll) .hd-stage::after, .hd-scroll .hd-stage > .slide::after { content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none; will-change: transform; background: var(--film-grain) 0 0 / 128px 128px, var(--film-dust) 0 0 / 200% 200% no-repeat; animation: var(--film-motion, hd-film .5s steps(1, end) -3.7ms infinite); }
251
+ }
252
+ /* Where the film holds still (any mode, whichever element carries it). */
253
+ :is(.hd-thumb, .hd-export:not(.hd-rolling)) { --film-motion: none; }
254
+ @media (prefers-reduced-motion: reduce) { :root { --film-motion: none; } }
255
+ /* A printed deck (the print view, lib/printView.ts) is pages, not a projection: no film. */
256
+ html[data-hd-print] :is(.hd-stage, .hd-stage > .slide)::after { content: none; }
257
+ /* Where the grain lands, where the dust lands (on the picture on five of the eight steps), and the light, step by step.
258
+ The dust layer is twice the stage, its specks and scratch in its far quarter, so it is sized and moved in the stage's own
259
+ units (a step at 100% 100% puts them where they are drawn, 0 0 parks them off the picture): the same specks land on the
260
+ same spots at any stage size, a phone's included. Its resting place is 0 0, so a film that holds still is grain only. */
261
+ @keyframes hd-film {
262
+ 0% { background-position: 0 0, 100% 100%; background-color: rgb(0 0 0 / var(--film-flicker)); }
263
+ 12.5% { background-position: 97px 41px, 43.75% 66.667%; background-color: rgb(0 0 0 / calc(var(--film-flicker) * .7)); }
264
+ 25% { background-position: 55px 104px, 0 0; background-color: rgb(0 0 0 / calc(var(--film-flicker) * .9)); }
265
+ 37.5% { background-position: 21px 73px, 73.75% 32.222%; background-color: rgb(0 0 0 / calc(var(--film-flicker) * .6)); }
266
+ 50% { background-position: 116px 12px, 0 0; background-color: rgb(0 0 0 / var(--film-flicker)); }
267
+ 62.5% { background-position: 35px 17px, 25% 83.333%; background-color: rgb(0 0 0 / calc(var(--film-flicker) * .55)); }
268
+ 75% { background-position: 68px 120px, 0 0; background-color: rgb(0 0 0 / calc(var(--film-flicker) * .85)); }
269
+ 87.5% { background-position: 110px 66px, 83.75% 47.778%; background-color: rgb(0 0 0 / calc(var(--film-flicker) * .65)); }
270
+ }
271
+ /* } hd-film */`;
272
+ export function withFilmRule(html) {
273
+ const rule = FILM_RULE;
274
+ const start = html.indexOf(FILM_START), end = start === -1 ? -1 : html.indexOf(FILM_END, start);
275
+ if (end !== -1) return html.slice(0, start) + rule + html.slice(end + FILM_END.length);
276
+ if (FILM_316.test(html)) return html.replace(FILM_316, () => ` ${rule}\n`);
277
+ return html.replace(/<\/head>/i, () => `<style data-hd-film>\n ${rule}\n</style>\n</head>`);
278
+ }
279
+
280
+ export function applyTheme(html, name) {
281
+ const theme = themeOrThrow(name);
282
+ const root = ROOT.exec(html);
283
+ if (!root) throw new Error("applyTheme: the deck has no :root block with --ink");
284
+ let block = root[0];
285
+ const vars = themeVars(theme);
286
+ // A deck made before --ink-text paints on-ink text in its paper: it keeps the ink as that ground, so the two still contrast.
287
+ if (!html.includes("var(--ink-text)")) vars["--ink-ground"] = "var(--ink)";
288
+ for (const [k, v] of Object.entries(vars)) block = setDecl(block, k, v);
289
+ // House titles use the body face at the template's weight and tracking.
290
+ for (const k of ["--display", "--display-weight", "--display-tracking"]) if (!(k in vars)) block = dropDecl(block, k);
291
+ let out = html.slice(0, root.index) + block + html.slice(root.index + root[0].length);
292
+ const link = `<link rel="stylesheet" href="${theme.fonts.href.replace(/&/g, "&amp;")}">`;
293
+ // Every Google Fonts link goes (a brand put on before may have added its own), and the theme's takes the first one's place.
294
+ const first = out.search(FONTS_LINK);
295
+ out = first === -1 ? out.replace("</head>", () => `${link}\n</head>`) : out.slice(0, first) + `${link}\n` + out.slice(first).replace(FONTS_LINK, "");
296
+ // Film grain is an SVG filter in the page (a data: URL filter is ignored by Chromium); add it once, before the slides.
297
+ if (vars["--photo-filter"].includes("url(#hd-grain)") && !out.includes('id="hd-grain"')) out = out.replace(/<body\b[^>]*>/i, (m) => `${m}\n${GRAIN_SVG}`);
298
+ // The film's tokens need its rules to draw anything: bring them (or bring an older copy up to date).
299
+ if (vars["--film"] === "1" || /@keyframes hd-film\b/.test(out)) out = withFilmRule(out);
300
+ out = /<html\b[^>]*\sdata-hd-theme="[^"]*"/i.test(out)
301
+ ? out.replace(/(<html\b[^>]*\sdata-hd-theme=")[^"]*"/i, (_, k) => `${k}${theme.id}"`)
302
+ : out.replace(/<html\b/i, (m) => `${m} data-hd-theme="${theme.id}"`);
303
+ return out;
304
+ }
305
+
306
+ // --- Contrast, computed from the tokens -------------------------------------
307
+ function rgb(hex) {
308
+ const h = hex.replace("#", ""), full = h.length === 3 ? [...h].map((c) => c + c).join("") : h.slice(0, 6);
309
+ return [0, 2, 4].map((i) => parseInt(full.slice(i, i + 2), 16));
310
+ }
311
+ const toHex = (c) => `#${c.map((v) => Math.round(Math.max(0, Math.min(255, v))).toString(16).padStart(2, "0")).join("")}`;
312
+ // color-mix(in srgb, a p%, b)
313
+ export const mixHex = (a, p, b) => { const [x, y] = [rgb(a), rgb(b)]; return toHex(x.map((v, i) => v * p + y[i] * (1 - p))); };
314
+ function luminance(hex) {
315
+ const [r, g, b] = rgb(hex).map((c) => c / 255).map((c) => (c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4));
316
+ return 0.2126 * r + 0.7152 * g + 0.0722 * b;
317
+ }
318
+ export const contrastRatio = (a, b) => { const [x, y] = [luminance(a), luminance(b)].sort((m, n) => n - m); return (x + 0.05) / (y + 0.05); };
319
+ export const isLight = (hex) => luminance(hex) > 0.18;
320
+
321
+ // Each ground a deck paints and the text colour on it: [name, ground, text].
322
+ export function groundPairs({ ink, paper, accent, accent2, accent3, card, accentInk = "ink", accentGround = "accent", inkGround = ink, inkText = paper }) {
323
+ const tint1 = mixHex(accent, 0.18, paper), tint2 = mixHex(accent2 ?? accent, 0.2, paper), tint3 = mixHex(accent3 ?? accent, 0.24, paper);
324
+ const onAccent = accentInk === "paper" ? paper : ink;
325
+ const aGround = accentGround === "tint-1" ? tint1 : accent;
326
+ return [
327
+ ["paper", paper, ink], ["card", card ?? paper, ink], ["accent", aGround, onAccent], ["ink", inkGround, inkText],
328
+ ["tint", tint1, ink], ["tint-2", tint2, ink], ["tint-3", tint3, ink],
329
+ ];
330
+ }
331
+ export function themePairs(theme) {
332
+ const g = theme.tokens["accent-ground"] === "var(--tint-1)" ? "tint-1" : "accent";
333
+ const t = theme.tokens, hex = (v) => (/^#[0-9a-f]{3,8}$/i.test(v) ? v : null);
334
+ const inkText = hex(t["ink-text"]) ?? (t["ink-text"] === "var(--ink)" ? theme.colors.ink : theme.colors.paper);
335
+ return groundPairs({ ...theme.colors, accentInk: theme.accentInk, accentGround: g, inkGround: hex(t["ink-ground"]) ?? theme.colors.ink, inkText });
336
+ }
337
+
338
+ // The themes as markdown: `hyperdecks theme list` and deck_guide { topic: "themes" }.
339
+ export function themesMarkdown() {
340
+ return [
341
+ "| theme | for |",
342
+ "| --- | --- |",
343
+ ...THEMES.map((t) => `| \`${t.id}\`${t.id === DEFAULT_THEME ? " (default)" : ""} | ${t.for} |`),
344
+ ].join("\n");
345
+ }
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
Binary file
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Phosphor Icons
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
Binary file