playwright-director 0.5.0 → 0.6.0

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 (88) hide show
  1. package/README.md +74 -10
  2. package/dist/Tutorial.d.ts.map +1 -1
  3. package/dist/Tutorial.js +1 -1
  4. package/dist/Tutorial.js.map +1 -1
  5. package/dist/init.js +11 -1
  6. package/dist/init.js.map +1 -1
  7. package/dist/site/build-site.d.ts +6 -0
  8. package/dist/site/build-site.d.ts.map +1 -1
  9. package/dist/site/build-site.js +13 -2
  10. package/dist/site/build-site.js.map +1 -1
  11. package/dist/site/embed.d.ts +9 -0
  12. package/dist/site/embed.d.ts.map +1 -1
  13. package/dist/site/embed.js +7 -3
  14. package/dist/site/embed.js.map +1 -1
  15. package/dist/site/generate-manifest.d.ts +2 -0
  16. package/dist/site/generate-manifest.d.ts.map +1 -1
  17. package/dist/site/generate-manifest.js +57 -16
  18. package/dist/site/generate-manifest.js.map +1 -1
  19. package/dist/site/scaffold.d.ts +6 -0
  20. package/dist/site/scaffold.d.ts.map +1 -1
  21. package/dist/site/scaffold.js +54 -8
  22. package/dist/site/scaffold.js.map +1 -1
  23. package/dist/site/scan-tutorials.d.ts +2 -0
  24. package/dist/site/scan-tutorials.d.ts.map +1 -1
  25. package/dist/site/scan-tutorials.js +3 -1
  26. package/dist/site/scan-tutorials.js.map +1 -1
  27. package/dist/site/seo.d.ts +22 -0
  28. package/dist/site/seo.d.ts.map +1 -0
  29. package/dist/site/seo.js +91 -0
  30. package/dist/site/seo.js.map +1 -0
  31. package/dist/site/strings.d.ts +19 -0
  32. package/dist/site/strings.d.ts.map +1 -1
  33. package/dist/site/strings.js +57 -3
  34. package/dist/site/strings.js.map +1 -1
  35. package/dist/site/tokens.d.ts +28 -0
  36. package/dist/site/tokens.d.ts.map +1 -0
  37. package/dist/site/tokens.js +38 -0
  38. package/dist/site/tokens.js.map +1 -0
  39. package/dist/site/types.d.ts +57 -12
  40. package/dist/site/types.d.ts.map +1 -1
  41. package/dist/timeline.d.ts +7 -1
  42. package/dist/timeline.d.ts.map +1 -1
  43. package/dist/timeline.js +5 -1
  44. package/dist/timeline.js.map +1 -1
  45. package/dist/types.d.ts +8 -0
  46. package/dist/types.d.ts.map +1 -1
  47. package/package.json +1 -1
  48. package/schemas/embed-v1.schema.json +5 -0
  49. package/skills/tutorialize/SKILL.md +7 -2
  50. package/skills/tutorialize/agent.md +4 -0
  51. package/skills/tutorialize/references/api.md +1 -0
  52. package/skills/tutorialize/references/site.md +158 -0
  53. package/templates/site/public/widget.js +16 -11
  54. package/templates/site/src/components/Emphasis.astro +8 -0
  55. package/templates/site/src/components/HomeLangs.astro +20 -0
  56. package/templates/site/src/components/LangSwitch.astro +20 -0
  57. package/templates/site/src/components/Lightbox.astro +50 -0
  58. package/templates/site/src/components/PrevNext.astro +40 -0
  59. package/templates/site/src/components/Seo.astro +42 -0
  60. package/templates/site/src/components/StepGuide.astro +115 -0
  61. package/templates/site/src/components/StepStrip.astro +33 -0
  62. package/templates/site/src/components/ThemeSwitcher.astro +22 -0
  63. package/templates/site/src/components/VariantFilter.astro +36 -0
  64. package/templates/site/src/components/VideoCard.astro +1 -103
  65. package/templates/site/src/components/VideoLinks.astro +19 -0
  66. package/templates/site/src/components/VideoModal.astro +66 -153
  67. package/templates/site/src/components/VideoPlayer.astro +43 -0
  68. package/templates/site/src/i18n.ts +8 -3
  69. package/templates/site/src/layouts/Shell.astro +46 -0
  70. package/templates/site/src/lib/filter.ts +24 -0
  71. package/templates/site/src/lib/site.ts +127 -0
  72. package/templates/site/src/pages/[lang]/index.astro +6 -6
  73. package/templates/site/src/pages/[slug].astro +5 -850
  74. package/templates/site/src/pages/index.astro +2 -2
  75. package/templates/site/src/styles/components.css +919 -0
  76. package/templates/site/src/styles/user.css +1 -0
  77. package/templates/themes/academy/CourseNav.astro +56 -0
  78. package/templates/themes/academy/Home.astro +139 -0
  79. package/templates/themes/academy/Layout.astro +48 -0
  80. package/templates/themes/academy/VideoPage.astro +75 -0
  81. package/templates/themes/academy/theme.css +979 -0
  82. package/templates/themes/classic/Home.astro +58 -0
  83. package/templates/themes/classic/Layout.astro +46 -0
  84. package/templates/themes/classic/VideoPage.astro +47 -0
  85. package/templates/themes/classic/theme.css +289 -0
  86. package/templates/site/src/components/TutorialsHome.astro +0 -169
  87. package/templates/site/src/layouts/Base.astro +0 -61
  88. package/templates/site/src/styles/tutorials.css +0 -303
@@ -0,0 +1 @@
1
+ /* Replaced by scaffold(): config `tokens` + the `css` file. */
@@ -0,0 +1,56 @@
1
+ ---
2
+ // Playlist sidebar: every section as an accordion of thumbnail rows; the current section open with the
3
+ // current video marked, so a reader moves between sections without going back to the home page.
4
+ import { videoHref, sections, loc, media, posterOf, sectionStats, type Video } from '../lib/site';
5
+ import { t } from '../i18n';
6
+
7
+ interface Props {
8
+ videos: Video[];
9
+ current: Video;
10
+ lang: string;
11
+ }
12
+
13
+ const { videos, current, lang } = Astro.props;
14
+ ---
15
+
16
+ <nav class="ac-course" aria-label={t(lang, 'courseContent')}>
17
+ {sections(videos).map((section) => {
18
+ const here = section.id === current.category;
19
+ const at = section.videos.findIndex((v) => v.id === current.id) + 1;
20
+ return (
21
+ <details open={here}>
22
+ <summary>
23
+ <span class="ac-course-label">{loc(section.label, lang)}</span>
24
+ <span class="ac-muted">
25
+ {here ? `· ${at}/${section.videos.length}` : sectionStats(lang, section.videos)}
26
+ </span>
27
+ </summary>
28
+ <ol>
29
+ {section.videos.map((v) => {
30
+ const poster = posterOf(v);
31
+ return (
32
+ <li>
33
+ <a href={videoHref(v)} aria-current={v.id === current.id ? 'page' : undefined}>
34
+ {poster ? <img src={media(poster)} alt="" loading="lazy" /> : <span class="ac-course-thumb"></span>}
35
+ <span class="ac-course-text">
36
+ <span class="ac-course-title">{v.title}</span>
37
+ <span class="ac-muted">{v.duration}</span>
38
+ </span>
39
+ </a>
40
+ </li>
41
+ );
42
+ })}
43
+ </ol>
44
+ </details>
45
+ );
46
+ })}
47
+ </nav>
48
+
49
+ <script>
50
+ // Bring the current video into view inside the scrolling sidebar (desktop) without moving the page.
51
+ const nav = document.querySelector<HTMLElement>('.ac-course');
52
+ const current = nav?.querySelector<HTMLElement>('[aria-current="page"]');
53
+ if (nav && current && nav.scrollHeight > nav.clientHeight) {
54
+ nav.scrollTop = current.offsetTop - nav.clientHeight / 3; // .ac-course is positioned: offsetTop is relative to it
55
+ }
56
+ </script>
@@ -0,0 +1,139 @@
1
+ ---
2
+ import Layout from './Layout.astro';
3
+ import VideoModal from '../components/VideoModal.astro';
4
+ import HomeLangs from '../components/HomeLangs.astro';
5
+ import VariantFilter from '../components/VariantFilter.astro';
6
+ import Emphasis from '../components/Emphasis.astro';
7
+ import { config, manifest, media, videoHref, videosForLang, sections, posterOf, loc, homeSeo, plainText, sectionStats, appHref, type Video } from '../lib/site';
8
+ import { normalize } from '../lib/filter';
9
+ import { t, siteLang } from '../i18n';
10
+
11
+ interface Props {
12
+ /** Page language — `/` is the site default, `/<lang>/` the others */
13
+ lang?: string;
14
+ }
15
+
16
+ const { ui } = manifest;
17
+ const lang = Astro.props.lang ?? siteLang;
18
+ const videos = videosForLang(lang);
19
+ const heroTitle = loc(ui.heroTitle, lang);
20
+ // The default subtitle is a UI string — translate it; a configured one stays as is.
21
+ const subtitle = ui.heroSubtitle === t(siteLang, 'videoTutorials') ? t(lang, 'videoTutorials') : loc(ui.heroSubtitle, lang);
22
+ const list = sections(videos);
23
+ const longest = Math.max(1, Math.ceil(Math.max(0, ...videos.map((v) => v.durationSeconds || 0)) / 60));
24
+ const featured = videos.find((v) => (v.slug ?? v.id) === manifest.featured) ?? videos[0];
25
+ const featuredPoster = featured && posterOf(featured);
26
+ const app = config.cta ? appHref(lang) : undefined;
27
+ // Normalized at build time: the client only normalizes the query.
28
+ const searchText = (v: Video) => normalize([v.title, v.description, ...(v.stepsDetail ?? []).flatMap((s) => [s.title, s.text])].filter(Boolean).join(' '));
29
+ const pad = (n: number) => String(n).padStart(2, '0');
30
+ ---
31
+
32
+ <Layout title={plainText(heroTitle)} description={subtitle} lang={lang} seo={homeSeo()}>
33
+ <slot name="head" slot="head" />
34
+ <HomeLangs lang={lang} slot="nav" />
35
+
36
+ <section class="ac-wrap ac-hero">
37
+ <div>
38
+ <p class="ac-eyebrow">{t(lang, 'heroEyebrow', { n: videos.length, m: longest })}</p>
39
+ <h1><Emphasis text={heroTitle} /></h1>
40
+ {subtitle && <p class="ac-lead">{subtitle}</p>}
41
+ <form class="ac-search" role="search" onsubmit="return false">
42
+ <label for="ac-search-input" class="ac-sr">{t(lang, 'search')}</label>
43
+ <input id="ac-search-input" type="search" placeholder={t(lang, 'search')} autocomplete="off" />
44
+ </form>
45
+ {list.length > 1 && (
46
+ <nav class="ac-chips" aria-label={t(lang, 'sections')}>
47
+ {list.map((s) => <a class="ac-chip" href={`#${s.id}`}>{loc(s.label, lang)}</a>)}
48
+ </nav>
49
+ )}
50
+ </div>
51
+ {featured && (
52
+ <a class="ac-featured" href={videoHref(featured)}>
53
+ {featuredPoster && <img src={media(featuredPoster)} alt="" loading="eager" />}
54
+ <span class="ac-featured-play" aria-hidden="true">▶</span>
55
+ <span class="ac-featured-body">
56
+ <span class="ac-kicker">{t(lang, 'startHere')}</span>
57
+ <span class="ac-featured-title">{featured.title} · {featured.duration}</span>
58
+ </span>
59
+ </a>
60
+ )}
61
+ </section>
62
+
63
+ <div class="ac-wrap ac-home">
64
+ <nav class="ac-toc" aria-label={t(lang, 'sections')}>
65
+ <ul>
66
+ {list.map((s) => (
67
+ <li><a href={`#${s.id}`}>{loc(s.label, lang)} <span class="ac-count">({s.videos.length})</span></a></li>
68
+ ))}
69
+ </ul>
70
+ </nav>
71
+
72
+ <div class="ac-sections">
73
+ <VariantFilter videos={videos} lang={lang} />
74
+ <p class="ac-empty" role="status" data-template={t(lang, 'noResults', { q: '{q}' })} hidden></p>
75
+ {list.map((section) => (
76
+ <section class="category ac-section" id={section.id} aria-labelledby={`h-${section.id}`}>
77
+ <header class="ac-section-head">
78
+ <div>
79
+ <h2 id={`h-${section.id}`}>{loc(section.label, lang)}</h2>
80
+ {section.blurb && <p class="ac-muted">{loc(section.blurb, lang)}</p>}
81
+ </div>
82
+ <span class="ac-muted">{sectionStats(lang, section.videos)}</span>
83
+ </header>
84
+ <div class="ac-grid">
85
+ {section.videos.map((video, j) => {
86
+ const poster = posterOf(video);
87
+ return (
88
+ <a
89
+ class="video-card ac-card ac-reveal"
90
+ href={videoHref(video)}
91
+ data-href={videoHref(video)}
92
+ data-video-url={media(video.file)}
93
+ data-video-id={video.id}
94
+ data-variant={video.variant ?? ''}
95
+ data-search={searchText(video)}
96
+ lang={video.lang}
97
+ >
98
+ <span class="ac-thumb" data-quickview>
99
+ {poster ? <img src={media(poster)} alt="" loading="lazy" /> : <span class="ac-thumb-empty"></span>}
100
+ <span class="ac-badge ac-duration">{video.duration}</span>
101
+ {video.premium && <span class="ac-badge ac-pro">PRO</span>}
102
+ </span>
103
+ <span class="ac-card-body">
104
+ <span class="ac-card-num" aria-hidden="true">{pad(j + 1)}</span>
105
+ <span class="video-title">{video.title}</span>
106
+ </span>
107
+ </a>
108
+ );
109
+ })}
110
+ </div>
111
+ </section>
112
+ ))}
113
+
114
+ {app && (
115
+ <section class="ac-cta ac-cta-wide">
116
+ <h2>{t(lang, 'ctaTitle')}</h2>
117
+ <p>{t(lang, 'ctaText')}</p>
118
+ <a class="ac-btn ac-btn-accent" href={app}>{t(lang, 'ctaButton')}</a>
119
+ </section>
120
+ )}
121
+ </div>
122
+ </div>
123
+
124
+ <VideoModal lang={lang} />
125
+ </Layout>
126
+
127
+ <script>
128
+ import { setFilter } from '../lib/filter';
129
+
130
+ const input = document.getElementById('ac-search-input') as HTMLInputElement | null;
131
+ const empty = document.querySelector<HTMLElement>('.ac-empty');
132
+ input?.addEventListener('input', () => setFilter({ query: input.value }));
133
+ document.addEventListener('pd:filter', (e) => {
134
+ const { visible, query } = (e as CustomEvent).detail;
135
+ if (!empty) return;
136
+ empty.hidden = visible > 0;
137
+ empty.textContent = (empty.dataset.template ?? '').replace('{q}', query);
138
+ });
139
+ </script>
@@ -0,0 +1,48 @@
1
+ ---
2
+ import Shell from '../layouts/Shell.astro';
3
+ import ThemeSwitcher from '../components/ThemeSwitcher.astro';
4
+ import type { SeoProps } from '../components/Seo.astro';
5
+ import { config, base, homeOf, appHref } from '../lib/site';
6
+ import { t, siteLang } from '../i18n';
7
+
8
+ interface Props {
9
+ title: string;
10
+ description?: string;
11
+ lang?: string;
12
+ seo?: SeoProps;
13
+ }
14
+
15
+ const { title, description, seo } = Astro.props;
16
+ const lang = Astro.props.lang || siteLang;
17
+ ---
18
+
19
+ <Shell title={title} description={description} lang={lang} seo={seo}>
20
+ <slot name="head" slot="head" />
21
+ <header class="ac-header">
22
+ <div class="ac-wrap">
23
+ <div class="ac-header-row" style="view-transition-name: ac-header">
24
+ <a href={homeOf(lang)} class="ac-logo">
25
+ {config.logo && <img src={`${base}${config.logo}`} alt="" class="ac-logo-img" />}
26
+ <span>{config.title}</span>
27
+ </a>
28
+ <div class="ac-header-end">
29
+ <slot name="nav" />
30
+ <ThemeSwitcher lang={lang} />
31
+ {appHref(lang) && (
32
+ <a class="ac-btn ac-btn-primary ac-header-app" href={appHref(lang)}>{t(lang, 'openApp')}</a>
33
+ )}
34
+ </div>
35
+ </div>
36
+ </div>
37
+ </header>
38
+ <main class="ac-main">
39
+ <slot />
40
+ </main>
41
+ <footer class="ac-footer">
42
+ <div class="ac-wrap">
43
+ <span>© {new Date().getFullYear()} {config.title}</span>
44
+ <span aria-hidden="true">·</span>
45
+ <span>{t(lang, 'builtWith')}</span>
46
+ </div>
47
+ </footer>
48
+ </Shell>
@@ -0,0 +1,75 @@
1
+ ---
2
+ import Layout from './Layout.astro';
3
+ import CourseNav from './CourseNav.astro';
4
+ import VideoPlayer from '../components/VideoPlayer.astro';
5
+ import LangSwitch from '../components/LangSwitch.astro';
6
+ import StepStrip from '../components/StepStrip.astro';
7
+ import StepGuide from '../components/StepGuide.astro';
8
+ import Lightbox from '../components/Lightbox.astro';
9
+ import PrevNext from '../components/PrevNext.astro';
10
+ import VideoLinks from '../components/VideoLinks.astro';
11
+ import { config, manifest, homeOf, loc, numberSteps, neighbours, videosForLang, steps, videoSeo, appHref, type Video } from '../lib/site';
12
+ import { t, siteLang } from '../i18n';
13
+
14
+ interface Props {
15
+ video: Video;
16
+ }
17
+
18
+ const { video } = Astro.props;
19
+ const L = video.lang ?? siteLang;
20
+ const numbered = numberSteps(video);
21
+ // Same list as the home page of this language, in section order: prev/next cross into the next section.
22
+ const list = videosForLang(L);
23
+ const { prev, next } = neighbours(list, video);
24
+ const sectionLabel = (v: Video) => loc(manifest.categories[v.category]?.label, L);
25
+ const nextLabel = next && next.category !== video.category ? `${t(L, 'nextSection')} · ${sectionLabel(next)}` : t(L, 'next');
26
+ const prevLabel = prev && prev.category !== video.category ? sectionLabel(prev) : t(L, 'previous');
27
+ const ctaHref = config.cta ? appHref(L, video) : undefined;
28
+ ---
29
+
30
+ <Layout title={video.title} description={video.description} lang={L} seo={videoSeo(video)}>
31
+ <slot name="head" slot="head" />
32
+ <LangSwitch video={video} slot="nav" />
33
+
34
+ <div class="ac-wrap ac-video">
35
+ <div class="ac-video-main">
36
+ <nav class="ac-crumbs" aria-label="breadcrumb">
37
+ <ol>
38
+ <li><a href={homeOf(L)}>{t(L, 'home')}</a></li>
39
+ <li><a href={`${homeOf(L)}#${video.category}`}>{sectionLabel(video)}</a></li>
40
+ <li aria-current="page">{video.title}</li>
41
+ </ol>
42
+ </nav>
43
+
44
+ <VideoPlayer video={video} />
45
+
46
+ <div class="ac-video-head">
47
+ <p class="ac-meta">
48
+ <span class="ac-chip">{sectionLabel(video)}</span>
49
+ <span class="ac-muted">{video.duration}</span>
50
+ {video.premium && <span class="ac-badge ac-pro">PRO</span>}
51
+ </p>
52
+ <h1>{video.title}</h1>
53
+ {video.description && <p class="ac-lead">{video.description}</p>}
54
+ <VideoLinks video={video} />
55
+ </div>
56
+
57
+ {steps.strip && <StepStrip steps={numbered} lang={L} />}
58
+ <StepGuide steps={numbered} layout={steps.layout} lang={L} />
59
+ <PrevNext prev={prev} next={next} lang={L} prevLabel={prevLabel} nextLabel={nextLabel} />
60
+ </div>
61
+
62
+ <aside class="ac-aside">
63
+ <CourseNav videos={list} current={video} lang={L} />
64
+ {ctaHref && (
65
+ <section class="ac-cta">
66
+ <h2>{t(L, 'ctaTitle')}</h2>
67
+ <p>{t(L, 'ctaText')}</p>
68
+ <a class="ac-btn ac-btn-accent" href={ctaHref}>{t(L, 'ctaButton')}</a>
69
+ </section>
70
+ )}
71
+ </aside>
72
+ </div>
73
+
74
+ {(steps.strip || steps.layout === 'cards') && <Lightbox />}
75
+ </Layout>