@joplo-app/plugin-content 0.0.0-stage → 0.4.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.
package/LICENSE ADDED
@@ -0,0 +1,97 @@
1
+ Required Notice: Copyright 2026 Joplo-app (https://joplo.app, support@joplo.app)
2
+
3
+ Licensor Line of Business: Joplo, a tool for authoring, previewing, reviewing, and publishing interactive product prototypes, demos, and presentations (https://joplo.app)
4
+ Licensor Line of Business: Joplo Cloud, a service for hosting, sharing, commenting on, reviewing, and measuring Joplo prototypes and presentations (https://joplo.app)
5
+
6
+ What counts as competing, and how to ask about other uses: see COMMERCIAL.md
7
+ https://github.com/Joplo-app/Joplo/blob/main/COMMERCIAL.md
8
+
9
+ # PolyForm Shield License 1.0.0
10
+
11
+ <https://polyformproject.org/licenses/shield/1.0.0>
12
+
13
+ ## Acceptance
14
+
15
+ In order to get any license under these terms, you must agree to them as both strict obligations and conditions to all your licenses.
16
+
17
+ ## Copyright License
18
+
19
+ The licensor grants you a copyright license for the software to do everything you might do with the software that would otherwise infringe the licensor's copyright in it for any permitted purpose. However, you may only distribute the software according to [Distribution License](#distribution-license) and make changes or new works based on the software according to [Changes and New Works License](#changes-and-new-works-license).
20
+
21
+ ## Distribution License
22
+
23
+ The licensor grants you an additional copyright license to distribute copies of the software. Your license to distribute covers distributing the software with changes and new works permitted by [Changes and New Works License](#changes-and-new-works-license).
24
+
25
+ ## Notices
26
+
27
+ You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms or the URL for them above, as well as copies of any plain-text lines beginning with `Required Notice:` that the licensor provided with the software. For example:
28
+
29
+ > Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
30
+
31
+ ## Changes and New Works License
32
+
33
+ The licensor grants you an additional copyright license to make changes and new works based on the software for any permitted purpose.
34
+
35
+ ## Patent License
36
+
37
+ The licensor grants you a patent license for the software that covers patent claims the licensor can license, or becomes able to license, that you would infringe by using the software.
38
+
39
+ ## Noncompete
40
+
41
+ Any purpose is a permitted purpose, except for providing any product that competes with the software or any product the licensor or any of its affiliates provides using the software.
42
+
43
+ ## Competition
44
+
45
+ Goods and services compete even when they provide functionality through different kinds of interfaces or for different technical platforms. Applications can compete with services, libraries with plugins, frameworks with development tools, and so on, even if they're written in different programming languages or for different computer architectures. Goods and services compete even when provided free of charge. If you market a product as a practical substitute for the software or another product, it definitely competes.
46
+
47
+ ## New Products
48
+
49
+ If you are using the software to provide a product that does not compete, but the licensor or any of its affiliates brings your product into competition by providing a new version of the software or another product using the software, you may continue using versions of the software available under these terms beforehand to provide your competing product, but not any later versions.
50
+
51
+ ## Discontinued Products
52
+
53
+ You may begin using the software to compete with a product or service that the licensor or any of its affiliates has stopped providing, unless the licensor includes a plain-text line beginning with `Licensor Line of Business:` with the software that mentions that line of business. For example:
54
+
55
+ > Licensor Line of Business: YoyodyneCMS Content Management System (http://example.com/cms)
56
+
57
+ ## Sales of Business
58
+
59
+ If the licensor or any of its affiliates sells a line of business developing the software or using the software to provide a product, the buyer can also enforce [Noncompete](#noncompete) for that product.
60
+
61
+ ## Fair Use
62
+
63
+ You may have "fair use" rights for the software under the law. These terms do not limit them.
64
+
65
+ ## No Other Rights
66
+
67
+ These terms do not allow you to sublicense or transfer any of your licenses to anyone else, or prevent the licensor from granting licenses to anyone else. These terms do not imply any other licenses.
68
+
69
+ ## Patent Defense
70
+
71
+ If you make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
72
+
73
+ ## Violations
74
+
75
+ The first time you are notified in writing that you have violated any of these terms, or done anything with the software not covered by your licenses, your licenses can nonetheless continue if you come into full compliance with these terms, and take practical steps to correct past violations, within 32 days of receiving notice. Otherwise, all your licenses end immediately.
76
+
77
+ ## No Liability
78
+
79
+ ***As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.***
80
+
81
+ ## Definitions
82
+
83
+ The **licensor** is the individual or entity offering these terms, and the **software** is the software the licensor makes available under these terms.
84
+
85
+ A **product** can be a good or service, or a combination of them.
86
+
87
+ **You** refers to the individual or entity agreeing to these terms.
88
+
89
+ **Your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all its affiliates.
90
+
91
+ **Affiliates** means the other organizations than an organization has control over, is under the control of, or is under common control with.
92
+
93
+ **Control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
94
+
95
+ **Your licenses** are all the licenses granted to you for the software under these terms.
96
+
97
+ **Use** means anything you do with the software requiring one of your licenses.
@@ -0,0 +1,2 @@
1
+ export declare const skill = "# Joplo content production: content\n\nFor explainers, tutorials, science and news-explainer pieces that should feel like a good video, not a deck: the viewer watches a world change while a voice explains it.\nSame machinery as demos: a feature is the episode, each case a chapter, each scenario plays one chapter (the published site plays them back to back), narrate() is the voice-over. Full example: examples/llm-explainer.\n\nInstall @joplo-app/plugin-content at the Joplo version; import content and add it to config.plugins. Import { Canvas, camera } from this package; keep flow, patch, narrate and hold from @joplo-app/kit. Use theme: 'content:studio' for the bundled CSS. No plugin is implicitly enabled.\n\n## 1. Before TSX: package and plan within the agreed scope\n- One thing the viewer should be able to repeat afterwards, in one sentence.\n- Package first: the title asks the question; a thumbnail line of at most five words gives the surprising answer (complement the title, never repeat it); flow({ description }) is the cover sentence. The share preview is the first scenario's first frame, so design that frame as a thumbnail: one big line, one focal object, high contrast.\n- If the framing is unresolved, offer two or three devices (one running example, misconception then correction, a number made tangible, before and after) with a recommendation. Reuse an already agreed design; do not repeat approval rounds the user has waived.\n- Chapters: one question per chapter. Case titles are numbered questions ('01 What does it actually read?'); expected is what the viewer can now say. List every point from the source material and map each to a chapter or drop it on purpose.\n- One running example through every chapter (the same prompt, person, or data set), so each chapter builds on what the viewer already saw.\n- Write the script as one line per step: ears (narrate), eyes (what changes on stage), source. Adjacent steps should connect with 'but' or 'so'; a chain of 'and then' is flat.\n- Budget: narration reads about 4.5 CJK characters (2.5 English words) per second; 45\u201390 s per chapter. About 400 CJK characters can already exceed 90 seconds. npx joplo outline counts narration in its estimates.\n\n## Asset-first preparation\nBefore building a device, historical interface or illustrated object, make an asset list. Prefer a suitable licensed library, icon set or model; do not hand-write complex SVG or build a model merely because JSX can draw it. Verify the actual asset license, collect files in assets/, retain licenses and record author, URL and modifications in assets/SOURCES.md. Historical facts and historical appearance are separate evidence: label stylized reconstructions and invented messages, and avoid copied logos/system icons. Use original work only when a suitable reusable asset is unavailable, keeping it simple.\n\n## 2. Hook (first chapter, 20\u201335 s)\n- Beat 1: a familiar scene that pays off the thumbnail. Never a logo, an agenda, or a definition first.\n- Beat 2: the twist, shown on stage (the answer splits into pieces with probabilities, a name changes on the second try).\n- Beat 3: pull back and name the questions the episode answers. Pin each question where it will be answered, and close every loop later.\n\n## 3. Not slides: one world, continuous objects, a moving camera (the core)\nFailure mode, even with nice graphics: one board per chapter (big title, panels, footer), chapter title cards, cards of bullets, things fading in and out. Viewers read it as a deck. Instead:\n- One layer holding one <Canvas w={2560} h={1600}> world (the default view is 1280\u00D7800, scaled to fit, never re-laid out; in a container without a height it sizes itself from the view ratio, and render warns 'Canvas has no size' if it still has none). Place a few containers absolutely in design pixels; lay out inside them with flex.\n- Objects keep their identity: give each one motion=\"key\". Write each arrangement as static JSX switched with when, reusing the same key; between steps Joplo flies the object from its old place and size to the new one, also across containers. Morph, never replace: the question's words split into tokens, flip into ids, then fly onto a tape; bars rearrange into a lottery strip.\n- shot() draws the host focus ring and caps UI zoom at 1.25\u00D7; use camera() for traveling inside a Canvas without that ring.\n- When another plugin effect also suggests host focus (for example a diagram trace inside a Canvas), use an explicit shot() for the whole director layer if the Canvas camera should own the framing. Otherwise host zoom and Canvas zoom can multiply and push nearby text out of view. Verify the actual visible bounds in playback, not only DOM text.\n- Camera: camera('id', \u2026) frames those elements (Joplo measures them, adds pad, caps zoom); camera() shows the whole canvas. Establish wide, push in on detail, pull back for the payoff. Object flights in the same step follow the camera's timing, so both land together.\n- Chapters continue: flow({ from: 'previousKey' }) starts from the previous chapter's last frame (state, camera, director layer). patch($.ui, { \u2026 }) changes several values in one step.\n- System-only chapters stay on the initial director layer unless camera(), shot(), a cue, or flow({ layer }) selects another layer. Continuing from a chapter inherits its final layer; do not copy its state by hand.\n- screen children of the Canvas stay fixed on screen: chapter label, source line, poster, end card.\n- Takeaways land on objects (a pinned question flips to '\u2713 answer'); the recap is a pull back to the whole world. Use .card() only when nothing on stage can carry the moment.\n```tsx\n<Canvas w={2560} h={1600}>\n <div id=\"tape\" style={{ position: 'absolute', left: 120, top: 960, display: 'flex', gap: 8 }}>\n {IDS.map((t, i) => <span when={eq($.ui.at, 'tape')} motion={`tok_${i}`} style={{ background: COLORS[i] }}>{t}</span>)}\n </div>\n <div screen style={{ position: 'absolute', left: 20, top: 16 }}>{$.ui.chapter}</div>\n</Canvas>\nflow('What does it read?', { from: 'hook' })\n .system('Split', 'Nine characters, seven pieces', patch($.ui, { mode: 'split' }), camera('bubble', { pad: 160 }))\n .system('To the tape', 'It reads these numbers', patch($.ui, { at: 'tape' }), camera('tape', 'meter'))\n```\n- Anti-deck test: three or more steps that only show or hide whole panels, or a frame that is mostly text, means rebuild those steps as objects that move or change.\n\n## 3b. Transitions, drift and the safe area\n- enter / exit on any element inside the Canvas (world or screen layer): fade, rise, zoom, shrink, wipe, iris. Timing: enterMs / enterDelay / exitMs / exitDelay (0\u201310000 ms literals; defaults 600 / 450). Each preset is an \"away\" pose: enter goes away \u2192 the element's own look, exit goes own look \u2192 away. So rise enters from below and exits sinking back; zoom lands from slightly larger and exits flying toward the camera; shrink grows from smaller and exits receding; wipe reveals left \u2192 right; iris opens from the centre. Set transform-origin in CSS to say where zoom/shrink grow from (a menu from its taskbar, a bubble from its tail).\n- enter plays when an element first appears (a new DOM node) during playback; exit plays when when becomes false: a non-interactive ghost copy keeps the last look and animates out, then disappears. Put enter + exit on two exclusive siblings in the same step for a crossfade. A same-motion-key element that flies (FLIP) never also enters or leaves.\n- Pick by meaning: fade for a whole-world swap under cover, rise for things that come from below (menus from a taskbar, keyboards, receipts), shrink for windows opening, zoom for something punching toward the viewer, wipe for typed/printed results, iris for a reveal from a point. Keep two or three per piece; do not give every element the same entrance.\n- camera(\u2026, { drift }) keeps the camera moving after it lands: a number = zoom factor reached over ms (default 8000), or { zoom, x, y, ms } with x/y in design px; false stops it. <Canvas drift={\u2026}> sets the default for every step; without either, a subtle 4 % / 8 s push applies. Drift eases in and out and stops at its end point; it freezes on pause, records in video, and screenshots/deep links show the settled frame without drift. The next camera move starts from where the drifting camera actually is.\n- <Canvas safe={[top, right, bottom, left]}> (design px) is the part of the view your screen-layer chrome covers. Targeted camera() frames fit inside the rest, and drift zooms around its centre; camera() with no ids still shows the whole world full-bleed.\n- UI life inside one interface (a caret blink, a stepped menu drop) can be CSS @keyframes in the project theme: the engine clock samples them, pause freezes them, static frames show their end state.\n\n## 4. Choose the information shape, then the picture\n- A number landing; before and after; ranking (bars from zero, length proportional); part of a whole (a strip whose segment widths are the shares); a process (one object going around a loop); misconception then fact; a timeline; a place (tiles or a simple map).\n- Similar sentences get different pictures. Labels sit on the thing they name; no legends when a direct label fits.\n- Compute numbers in TS from one source (for example probabilities from one set of scores) so every number on screen agrees. Label illustrative numbers on screen ('illustrative'), separate from sourced facts.\n\n## 5. Motion and layout numbers\n- Camera moves 1\u20131.5 s, ease in-out. Object flights 0.9 s ease-out; stagger 60\u2013120 ms (motionDelay); slow a landing pointer to 1.5\u20132 s (motionMs).\n- One primary motion per step; text that is being read does not move.\n- Entrances and exits: use enter / exit (section 3b); for effects the presets do not cover put @keyframes and classes in themes/<name>.css and use className (staggered with animationDelay). Screenshots, thumbnails, and jumps show the end state. For a typewriter reveal give each character a short linear fade (about 80 ms) with its own delay; a 1 ms steps(1) animation can stay stuck invisible in Chromium.\n- One accent color with a fixed meaning; color means the same thing in every chapter.\n- Size text for the frame you show: about 28 design px is the floor at 1\u00D7 zoom; a wide shot at 0.5\u00D7 needs 40 or more, or enlarge the labels for that shot (a bigger variant under the same motion key).\n- Frame by content (camera ids), not by guessed coordinates. Lay the world out as shot-sized clusters of roughly 16:10 (a machine with its output bars and strip, a chat with its bubbles); a cluster much wider than that leaves half the frame empty however you aim.\n- Same subject, same frame: keep one camera for consecutive steps about the same cluster; frame what stays on stage (not a container that has just emptied).\n\n## 6. Narration, captions, numbers\n- Caption: what the eye needs, ideally at most 16 CJK characters (24 is the hard limit). narrate(): what a presenter says, one or two sentences (rules: story section 6).\n- One number per step, rounded and written as spoken; translate numbers ('one chance in 365'). Pointing words are fine ('look at the dashed line').\n- When narration is on, keep on-stage text to labels; do not put the narrated sentence on screen too.\n\n## 7. Facts and sources\n- All facts in one data module with source and date; a source line (screen element) per chapter; name studies in narration ('OpenAI, in a 2025 paper, explains \u2026').\n- Say only what the source says. Bars start at zero. Separate illustrative values from facts on screen.\n- Images: licensed or public domain, credited, CREDITS file next to them (story section 7).\n\n## 8. Ending\n- Pull back to the whole world: every pinned question now shows its answer. Then one concrete action the viewer can take right away, as a screen element. Stop once the value lands; no 'thanks for watching'.\n\n## 9. Required: review before handing over\n- npx joplo check until 0 errors. HAPPY_PATH_ONLY is expected for explainers whose chapters are all main-flow; do not invent failure scenarios to silence it.\n- Storyboard every chapter: npx joplo render --scenario-id <id> --sheet --out board.png prints every step in one image with its caption and narration. Read it frame by frame and assume the first one has problems: half-empty frames, objects cut at the edge, labels overlapping, text too small in wide shots, the chapter label covering content. Fix, then storyboard again.\n- Film-strip every chain of chapters: npx joplo render <dir> --scenario-id <first> --film --chain --out film.png. Fix every red CUT (one-frame full-screen change) unless it is your one deliberate cut, and every grey STILL (no visible change for \u2265 1.5 s). The storyboard cannot show either. Engine checklist: npx joplo skill demo, \"Make it play like a film\".\n- Play each chapter in the board with Voice on: flights and camera land together, nothing leaves the frame mid-flight, narration finishes before the next step.\n- Evidence, not belief: 'it plays' needs check 0 errors plus a run in the board; 'it looks right' needs the rendered frames; 'it is clear' needs captions-only and frames-only passes that both tell the story.\n- Tell the user what you could not verify (a real voice on a phone, other window sizes).\n\n## Diagnostics and recovery\n- CAMERA_UNKNOWN: the id must exist in a current layer or stage; frame elements inside this Canvas. CAMERA_INVALID: pad 0\u20132000, zoom 0.1\u201310, ms 0\u201310000, drift false | 0.5\u20132 | { zoom 0.5\u20132, x/y \u22122000\u20132000, ms 500\u201360000 }, finite numbers only; <Canvas drift> takes the same values and <Canvas safe> is four numbers 0\u20132000.\n- PLUGIN_PROPERTY_INVALID: motion is a nonempty string; motionDelay/motionMs/enterMs/enterDelay/exitMs/exitDelay are finite numbers 0\u201310000; screen is boolean; enter/exit are one of fade, rise, zoom, shrink, wipe, iris. These universal properties are literals, not state bindings. Use separate same-key elements with when for a flight between containers.\n- Exit ghosts appear only during playback, never in screenshots, thumbnails, deep links, reduced motion or after a jump. They settle instantly (enter jumps to its end, ghosts vanish) on a jump, stop, scene change and the viewer's first input on the stage (a click, key or drag; the player's pause button keeps them frozen), so the input always acts on the final picture. The camera does not settle on input: it freezes where it is. Ghosts carry no id: camera, hints and Alt-click never target them.\n- Known limits (0.3.0): put exit on the removed container itself \u2014 an exit only on a child of a removed, transformed (scaled) container loses that ancestor's transform for its first frame. An element removed while its enter is still running exits from its base look (a small jump): keep enter shorter than the step. Two elements sharing a motion key with the same layout get neither enter nor exit: use different keys, or change the layout so a flight happens.\n- Give each visible object one motion key. Hidden previous locations remain available for a later same-key arrival. Avoid duplicate simultaneously visible keys. Independent translate/scale keeps the author's transform intact.\n- Cross-container flights temporarily lift clipping ancestors inside the world and restore their overflow at finish/cancel. During playground edits the flight yields its visual transform to the final usable layout while preserving its animation/time anchor for resume. Do not globally remove device clipping or duplicate the animated control to make it clickable; test first input during a flight.\n- Keep camera and FLIP duration together when both move; motionMs explicitly overrides duration, including 0. animate=false cancels an existing flight and renders the final layout.\n- A Canvas with no parent height uses its view aspect ratio; with an explicit parent height it fills that parent. A zero-sized parent still needs a layout fix; render reports the measured surface.\n- screen only separates direct Canvas children into the fixed overlay. Nested screen props remain ordinary descendants.\n- One world per continuous chapter; use flow({ from }) to avoid manually copied end states. The initial frame and every step contain complete compiled drawing snapshots; deep links do not replay plugin logic.\n- HAPPY_PATH_ONLY is expected for a main-flow explainer. Do not invent product failures solely to silence it. Review every storyboard and verify animation separately from static renders.\n";
2
+ export declare const patterns = "# content recipes and pitfalls\n\n## Museum-film composition\n- Collect licensed artwork and a real subject asset first. Let an archival image supply the historical texture and the subject supply the action; use CSS only for framing, gradients and typography. Label illustrative artwork when it is not evidence of the place or event.\n- Put the Canvas inside a wrapper with an explicit height (for a board-filling root, height:100%). An auto-height wrapper can remain 800px tall while the board is shorter: exports look correct but lower controls are clipped. Test the actual board at a short height as well as render.\n- Keep chapter/source labels as direct screen children when the world camera travels. Nested screen does not escape its parent. Frame a stable hero cluster with a modest pad; an oversized pad may zoom out and expose empty margins instead of producing a close-up.\n- For a subject entering a device, establish the device first or in the same step, then shrink and move the subject into its screen. Keep the ending actionable through real forks or controls. Reuse the stable subject identity described below.\n- Match-cut the subject at a chapter boundary while changing its background and sound in that same scripted step. The input stays concrete: click the object, drag it to a visible destination, or choose an explicitly labeled branch. Avoid a slide of historical bullet points.\n\n## Shot grammar for a playable short film\nGive each chapter a visual arc: establish the whole interface/device, move in on the meaningful input or action, show its result, then pull back. Keep chapter numbers and explanations subordinate to the working surface. Judge text at its final painted size, including Canvas scale and camera zoom, rather than the font-size declaration alone.\n\nUse camera ids for the object that matters. Framing a wide window rarely produces a button close-up; frame the button for anticipation and button plus receipt for the result. Keep those targets inside one visual cluster. A deliberate crop is useful; a required action cropped out of the current frame is a broken shot.\n\nWhen a whole-stage camera would collide with navigation or titles, either put Canvas in a separately sized parent whose view matches the picture region (controls stay in the surrounding layout), or go full-bleed: put the title and timeline on the screen layer over the moving picture and give <Canvas safe={[top, right, bottom, left]}> the covered bands so targeted framings land in the clear part. Full-bleed lets a push-in fill the whole frame, which a boxed picture cannot.\n\n## Match cut through the subject (chapter seam)\nOne sentence: push in until the recurring object fills the frame, swap the world behind it, pull back to reveal the new world.\n- Use for: era/place/version changes where one object stays the subject (a button through four decades, a product through iterations). At most one signature seam style per piece; reuse it for every chapter seam.\n- Duration and energy: push 1.6\u20131.9 s, cover held about 1 s (the next action can happen under it), pull-back 2.4\u20132.8 s; high energy at the swap, calm after.\n- Set-up: put every version of the object with its centre on the same world point and add an invisible lens element there; give the versions one motion key so the new one morphs from the old size.\n- Beat 1 (end of chapter N): camera('lens', { pad: 0, zoom: 8\u20139, ms: 1800 }); start the next chapter's music here with fadeMs 2000\u20132600 (J-cut).\n- Beat 2 (first step of chapter N+1): switch the state that swaps the worlds (old interface exit=\"fade\", new interface enter=\"fade\", 800\u20131000 ms each) and in the same step camera('<new overview>', { ms: 2400\u20132800 }). The camera curve starts slowly, so the crossfade happens while the object still covers the frame, then the new world opens up. Put the chapter's timeline/scrubber movement and year label change in this same step.\n- Keep (do not downgrade): the shared centre point (otherwise the camera whips across the world at 8\u00D7 and the old ghost slides away), the slow-start pull-back, and exit/enter on whole interfaces rather than on each child.\n- Known pitfalls: a fine 1-px checker or hairline pattern behind the object shimmers (moir\u00E9) at high zoom \u2014 use a low-contrast texture; a deep link or timeline jump to beat 2 lands on the settled overview, which is what a viewer jumping chapters wants; verify the seam in the film strip (no red CUT) and at full size with --frames.\n- Reference: examples/button-40-years (features/forty/options/a.tsx, throughTheButton).\n\nAn older variant moves the object out of its interface into a central arrangement before the next chapter catches it (same motion key, exclusive when). It reads as a transfer beat rather than a cut; verify a mid-flight frame in playback because static sheets show only the declared endpoints.\n\n## A continuous object inside playable chapter interfaces\nUse one motion key for the recurring object and distinct element ids for its location in each mutually exclusive arrangement. Keep exactly one visible instance. Each interface should contain a real native input or declared local reaction: the same picture must make sense both during playback and after the viewer pauses.\n\nA useful story holds the message or task constant while the surrounding interface changes. The motion gives continuity; the input, menu and result prove the interaction paradigm. Label canned results explicitly when the audience can type arbitrary requests. Do not imply a model or backend computed a result.\n\nFor the match-cut transition above, use from for continuity, and the engine's actionEntry: 'after' when a confirmed chapter drag should immediately show the new arrangement. Static storyboards prove layout; observe real playback to verify FLIP travel. If a flight does not appear, check for two visible same-key objects, a replaced Canvas/stage, or a manual jump with animate=false before changing the animation.\n\nKeep credits and sources outside the animated object area. Render every chapter and inspect the target frame after seeking; then test real typing, first-input pause, hover/touch, reset, continue and cross-chapter confirmation. A menu temporarily covering content is expected while open; verify it closes before the next action needs that content.\n\n## Pitfalls that make a film feel like slides\n- Holds with a frozen camera: drift is on by default; do not turn it off for reading holds \u2014 a 1\u20138 % eased push is enough. If the film strip still marks STILL, the drift is too weak for that framing (flat UI shows little change); raise zoom or add x/y.\n- Every element using the same entrance: vary by meaning (section 3b) and stagger with enterDelay; let new things start before old ones finish leaving.\n- A whole interface replaced in one frame (when swap without exit/enter) is a hard cut. Give both sides a transition or cover the swap with the subject.\n- Whole-screen white/colour flashes over a still picture look like a stalled player; keep the picture moving under any fade.\n\nCommon pitfall: For visual explainers, read npx joplo skill content: keep a continuous visual story, storyboard every chapter, film-strip the chain, and verify playback before claiming it works";
package/dist/guide.js ADDED
@@ -0,0 +1,149 @@
1
+ export const skill = `# Joplo content production: content
2
+
3
+ For explainers, tutorials, science and news-explainer pieces that should feel like a good video, not a deck: the viewer watches a world change while a voice explains it.
4
+ Same machinery as demos: a feature is the episode, each case a chapter, each scenario plays one chapter (the published site plays them back to back), narrate() is the voice-over. Full example: examples/llm-explainer.
5
+
6
+ Install @joplo-app/plugin-content at the Joplo version; import content and add it to config.plugins. Import { Canvas, camera } from this package; keep flow, patch, narrate and hold from @joplo-app/kit. Use theme: 'content:studio' for the bundled CSS. No plugin is implicitly enabled.
7
+
8
+ ## 1. Before TSX: package and plan within the agreed scope
9
+ - One thing the viewer should be able to repeat afterwards, in one sentence.
10
+ - Package first: the title asks the question; a thumbnail line of at most five words gives the surprising answer (complement the title, never repeat it); flow({ description }) is the cover sentence. The share preview is the first scenario's first frame, so design that frame as a thumbnail: one big line, one focal object, high contrast.
11
+ - If the framing is unresolved, offer two or three devices (one running example, misconception then correction, a number made tangible, before and after) with a recommendation. Reuse an already agreed design; do not repeat approval rounds the user has waived.
12
+ - Chapters: one question per chapter. Case titles are numbered questions ('01 What does it actually read?'); expected is what the viewer can now say. List every point from the source material and map each to a chapter or drop it on purpose.
13
+ - One running example through every chapter (the same prompt, person, or data set), so each chapter builds on what the viewer already saw.
14
+ - Write the script as one line per step: ears (narrate), eyes (what changes on stage), source. Adjacent steps should connect with 'but' or 'so'; a chain of 'and then' is flat.
15
+ - Budget: narration reads about 4.5 CJK characters (2.5 English words) per second; 45–90 s per chapter. About 400 CJK characters can already exceed 90 seconds. npx joplo outline counts narration in its estimates.
16
+
17
+ ## Asset-first preparation
18
+ Before building a device, historical interface or illustrated object, make an asset list. Prefer a suitable licensed library, icon set or model; do not hand-write complex SVG or build a model merely because JSX can draw it. Verify the actual asset license, collect files in assets/, retain licenses and record author, URL and modifications in assets/SOURCES.md. Historical facts and historical appearance are separate evidence: label stylized reconstructions and invented messages, and avoid copied logos/system icons. Use original work only when a suitable reusable asset is unavailable, keeping it simple.
19
+
20
+ ## 2. Hook (first chapter, 20–35 s)
21
+ - Beat 1: a familiar scene that pays off the thumbnail. Never a logo, an agenda, or a definition first.
22
+ - Beat 2: the twist, shown on stage (the answer splits into pieces with probabilities, a name changes on the second try).
23
+ - Beat 3: pull back and name the questions the episode answers. Pin each question where it will be answered, and close every loop later.
24
+
25
+ ## 3. Not slides: one world, continuous objects, a moving camera (the core)
26
+ Failure mode, even with nice graphics: one board per chapter (big title, panels, footer), chapter title cards, cards of bullets, things fading in and out. Viewers read it as a deck. Instead:
27
+ - One layer holding one <Canvas w={2560} h={1600}> world (the default view is 1280×800, scaled to fit, never re-laid out; in a container without a height it sizes itself from the view ratio, and render warns 'Canvas has no size' if it still has none). Place a few containers absolutely in design pixels; lay out inside them with flex.
28
+ - Objects keep their identity: give each one motion="key". Write each arrangement as static JSX switched with when, reusing the same key; between steps Joplo flies the object from its old place and size to the new one, also across containers. Morph, never replace: the question's words split into tokens, flip into ids, then fly onto a tape; bars rearrange into a lottery strip.
29
+ - shot() draws the host focus ring and caps UI zoom at 1.25×; use camera() for traveling inside a Canvas without that ring.
30
+ - When another plugin effect also suggests host focus (for example a diagram trace inside a Canvas), use an explicit shot() for the whole director layer if the Canvas camera should own the framing. Otherwise host zoom and Canvas zoom can multiply and push nearby text out of view. Verify the actual visible bounds in playback, not only DOM text.
31
+ - Camera: camera('id', …) frames those elements (Joplo measures them, adds pad, caps zoom); camera() shows the whole canvas. Establish wide, push in on detail, pull back for the payoff. Object flights in the same step follow the camera's timing, so both land together.
32
+ - Chapters continue: flow({ from: 'previousKey' }) starts from the previous chapter's last frame (state, camera, director layer). patch($.ui, { … }) changes several values in one step.
33
+ - System-only chapters stay on the initial director layer unless camera(), shot(), a cue, or flow({ layer }) selects another layer. Continuing from a chapter inherits its final layer; do not copy its state by hand.
34
+ - screen children of the Canvas stay fixed on screen: chapter label, source line, poster, end card.
35
+ - Takeaways land on objects (a pinned question flips to '✓ answer'); the recap is a pull back to the whole world. Use .card() only when nothing on stage can carry the moment.
36
+ \`\`\`tsx
37
+ <Canvas w={2560} h={1600}>
38
+ <div id="tape" style={{ position: 'absolute', left: 120, top: 960, display: 'flex', gap: 8 }}>
39
+ {IDS.map((t, i) => <span when={eq($.ui.at, 'tape')} motion={\`tok_\${i}\`} style={{ background: COLORS[i] }}>{t}</span>)}
40
+ </div>
41
+ <div screen style={{ position: 'absolute', left: 20, top: 16 }}>{$.ui.chapter}</div>
42
+ </Canvas>
43
+ flow('What does it read?', { from: 'hook' })
44
+ .system('Split', 'Nine characters, seven pieces', patch($.ui, { mode: 'split' }), camera('bubble', { pad: 160 }))
45
+ .system('To the tape', 'It reads these numbers', patch($.ui, { at: 'tape' }), camera('tape', 'meter'))
46
+ \`\`\`
47
+ - Anti-deck test: three or more steps that only show or hide whole panels, or a frame that is mostly text, means rebuild those steps as objects that move or change.
48
+
49
+ ## 3b. Transitions, drift and the safe area
50
+ - enter / exit on any element inside the Canvas (world or screen layer): fade, rise, zoom, shrink, wipe, iris. Timing: enterMs / enterDelay / exitMs / exitDelay (0–10000 ms literals; defaults 600 / 450). Each preset is an "away" pose: enter goes away → the element's own look, exit goes own look → away. So rise enters from below and exits sinking back; zoom lands from slightly larger and exits flying toward the camera; shrink grows from smaller and exits receding; wipe reveals left → right; iris opens from the centre. Set transform-origin in CSS to say where zoom/shrink grow from (a menu from its taskbar, a bubble from its tail).
51
+ - enter plays when an element first appears (a new DOM node) during playback; exit plays when when becomes false: a non-interactive ghost copy keeps the last look and animates out, then disappears. Put enter + exit on two exclusive siblings in the same step for a crossfade. A same-motion-key element that flies (FLIP) never also enters or leaves.
52
+ - Pick by meaning: fade for a whole-world swap under cover, rise for things that come from below (menus from a taskbar, keyboards, receipts), shrink for windows opening, zoom for something punching toward the viewer, wipe for typed/printed results, iris for a reveal from a point. Keep two or three per piece; do not give every element the same entrance.
53
+ - camera(…, { drift }) keeps the camera moving after it lands: a number = zoom factor reached over ms (default 8000), or { zoom, x, y, ms } with x/y in design px; false stops it. <Canvas drift={…}> sets the default for every step; without either, a subtle 4 % / 8 s push applies. Drift eases in and out and stops at its end point; it freezes on pause, records in video, and screenshots/deep links show the settled frame without drift. The next camera move starts from where the drifting camera actually is.
54
+ - <Canvas safe={[top, right, bottom, left]}> (design px) is the part of the view your screen-layer chrome covers. Targeted camera() frames fit inside the rest, and drift zooms around its centre; camera() with no ids still shows the whole world full-bleed.
55
+ - UI life inside one interface (a caret blink, a stepped menu drop) can be CSS @keyframes in the project theme: the engine clock samples them, pause freezes them, static frames show their end state.
56
+
57
+ ## 4. Choose the information shape, then the picture
58
+ - A number landing; before and after; ranking (bars from zero, length proportional); part of a whole (a strip whose segment widths are the shares); a process (one object going around a loop); misconception then fact; a timeline; a place (tiles or a simple map).
59
+ - Similar sentences get different pictures. Labels sit on the thing they name; no legends when a direct label fits.
60
+ - Compute numbers in TS from one source (for example probabilities from one set of scores) so every number on screen agrees. Label illustrative numbers on screen ('illustrative'), separate from sourced facts.
61
+
62
+ ## 5. Motion and layout numbers
63
+ - Camera moves 1–1.5 s, ease in-out. Object flights 0.9 s ease-out; stagger 60–120 ms (motionDelay); slow a landing pointer to 1.5–2 s (motionMs).
64
+ - One primary motion per step; text that is being read does not move.
65
+ - Entrances and exits: use enter / exit (section 3b); for effects the presets do not cover put @keyframes and classes in themes/<name>.css and use className (staggered with animationDelay). Screenshots, thumbnails, and jumps show the end state. For a typewriter reveal give each character a short linear fade (about 80 ms) with its own delay; a 1 ms steps(1) animation can stay stuck invisible in Chromium.
66
+ - One accent color with a fixed meaning; color means the same thing in every chapter.
67
+ - Size text for the frame you show: about 28 design px is the floor at 1× zoom; a wide shot at 0.5× needs 40 or more, or enlarge the labels for that shot (a bigger variant under the same motion key).
68
+ - Frame by content (camera ids), not by guessed coordinates. Lay the world out as shot-sized clusters of roughly 16:10 (a machine with its output bars and strip, a chat with its bubbles); a cluster much wider than that leaves half the frame empty however you aim.
69
+ - Same subject, same frame: keep one camera for consecutive steps about the same cluster; frame what stays on stage (not a container that has just emptied).
70
+
71
+ ## 6. Narration, captions, numbers
72
+ - Caption: what the eye needs, ideally at most 16 CJK characters (24 is the hard limit). narrate(): what a presenter says, one or two sentences (rules: story section 6).
73
+ - One number per step, rounded and written as spoken; translate numbers ('one chance in 365'). Pointing words are fine ('look at the dashed line').
74
+ - When narration is on, keep on-stage text to labels; do not put the narrated sentence on screen too.
75
+
76
+ ## 7. Facts and sources
77
+ - All facts in one data module with source and date; a source line (screen element) per chapter; name studies in narration ('OpenAI, in a 2025 paper, explains …').
78
+ - Say only what the source says. Bars start at zero. Separate illustrative values from facts on screen.
79
+ - Images: licensed or public domain, credited, CREDITS file next to them (story section 7).
80
+
81
+ ## 8. Ending
82
+ - Pull back to the whole world: every pinned question now shows its answer. Then one concrete action the viewer can take right away, as a screen element. Stop once the value lands; no 'thanks for watching'.
83
+
84
+ ## 9. Required: review before handing over
85
+ - npx joplo check until 0 errors. HAPPY_PATH_ONLY is expected for explainers whose chapters are all main-flow; do not invent failure scenarios to silence it.
86
+ - Storyboard every chapter: npx joplo render --scenario-id <id> --sheet --out board.png prints every step in one image with its caption and narration. Read it frame by frame and assume the first one has problems: half-empty frames, objects cut at the edge, labels overlapping, text too small in wide shots, the chapter label covering content. Fix, then storyboard again.
87
+ - Film-strip every chain of chapters: npx joplo render <dir> --scenario-id <first> --film --chain --out film.png. Fix every red CUT (one-frame full-screen change) unless it is your one deliberate cut, and every grey STILL (no visible change for ≥ 1.5 s). The storyboard cannot show either. Engine checklist: npx joplo skill demo, "Make it play like a film".
88
+ - Play each chapter in the board with Voice on: flights and camera land together, nothing leaves the frame mid-flight, narration finishes before the next step.
89
+ - Evidence, not belief: 'it plays' needs check 0 errors plus a run in the board; 'it looks right' needs the rendered frames; 'it is clear' needs captions-only and frames-only passes that both tell the story.
90
+ - Tell the user what you could not verify (a real voice on a phone, other window sizes).
91
+
92
+ ## Diagnostics and recovery
93
+ - CAMERA_UNKNOWN: the id must exist in a current layer or stage; frame elements inside this Canvas. CAMERA_INVALID: pad 0–2000, zoom 0.1–10, ms 0–10000, drift false | 0.5–2 | { zoom 0.5–2, x/y −2000–2000, ms 500–60000 }, finite numbers only; <Canvas drift> takes the same values and <Canvas safe> is four numbers 0–2000.
94
+ - PLUGIN_PROPERTY_INVALID: motion is a nonempty string; motionDelay/motionMs/enterMs/enterDelay/exitMs/exitDelay are finite numbers 0–10000; screen is boolean; enter/exit are one of fade, rise, zoom, shrink, wipe, iris. These universal properties are literals, not state bindings. Use separate same-key elements with when for a flight between containers.
95
+ - Exit ghosts appear only during playback, never in screenshots, thumbnails, deep links, reduced motion or after a jump. They settle instantly (enter jumps to its end, ghosts vanish) on a jump, stop, scene change and the viewer's first input on the stage (a click, key or drag; the player's pause button keeps them frozen), so the input always acts on the final picture. The camera does not settle on input: it freezes where it is. Ghosts carry no id: camera, hints and Alt-click never target them.
96
+ - Known limits (0.3.0): put exit on the removed container itself — an exit only on a child of a removed, transformed (scaled) container loses that ancestor's transform for its first frame. An element removed while its enter is still running exits from its base look (a small jump): keep enter shorter than the step. Two elements sharing a motion key with the same layout get neither enter nor exit: use different keys, or change the layout so a flight happens.
97
+ - Give each visible object one motion key. Hidden previous locations remain available for a later same-key arrival. Avoid duplicate simultaneously visible keys. Independent translate/scale keeps the author's transform intact.
98
+ - Cross-container flights temporarily lift clipping ancestors inside the world and restore their overflow at finish/cancel. During playground edits the flight yields its visual transform to the final usable layout while preserving its animation/time anchor for resume. Do not globally remove device clipping or duplicate the animated control to make it clickable; test first input during a flight.
99
+ - Keep camera and FLIP duration together when both move; motionMs explicitly overrides duration, including 0. animate=false cancels an existing flight and renders the final layout.
100
+ - A Canvas with no parent height uses its view aspect ratio; with an explicit parent height it fills that parent. A zero-sized parent still needs a layout fix; render reports the measured surface.
101
+ - screen only separates direct Canvas children into the fixed overlay. Nested screen props remain ordinary descendants.
102
+ - One world per continuous chapter; use flow({ from }) to avoid manually copied end states. The initial frame and every step contain complete compiled drawing snapshots; deep links do not replay plugin logic.
103
+ - HAPPY_PATH_ONLY is expected for a main-flow explainer. Do not invent product failures solely to silence it. Review every storyboard and verify animation separately from static renders.
104
+ `;
105
+ export const patterns = `# content recipes and pitfalls
106
+
107
+ ## Museum-film composition
108
+ - Collect licensed artwork and a real subject asset first. Let an archival image supply the historical texture and the subject supply the action; use CSS only for framing, gradients and typography. Label illustrative artwork when it is not evidence of the place or event.
109
+ - Put the Canvas inside a wrapper with an explicit height (for a board-filling root, height:100%). An auto-height wrapper can remain 800px tall while the board is shorter: exports look correct but lower controls are clipped. Test the actual board at a short height as well as render.
110
+ - Keep chapter/source labels as direct screen children when the world camera travels. Nested screen does not escape its parent. Frame a stable hero cluster with a modest pad; an oversized pad may zoom out and expose empty margins instead of producing a close-up.
111
+ - For a subject entering a device, establish the device first or in the same step, then shrink and move the subject into its screen. Keep the ending actionable through real forks or controls. Reuse the stable subject identity described below.
112
+ - Match-cut the subject at a chapter boundary while changing its background and sound in that same scripted step. The input stays concrete: click the object, drag it to a visible destination, or choose an explicitly labeled branch. Avoid a slide of historical bullet points.
113
+
114
+ ## Shot grammar for a playable short film
115
+ Give each chapter a visual arc: establish the whole interface/device, move in on the meaningful input or action, show its result, then pull back. Keep chapter numbers and explanations subordinate to the working surface. Judge text at its final painted size, including Canvas scale and camera zoom, rather than the font-size declaration alone.
116
+
117
+ Use camera ids for the object that matters. Framing a wide window rarely produces a button close-up; frame the button for anticipation and button plus receipt for the result. Keep those targets inside one visual cluster. A deliberate crop is useful; a required action cropped out of the current frame is a broken shot.
118
+
119
+ When a whole-stage camera would collide with navigation or titles, either put Canvas in a separately sized parent whose view matches the picture region (controls stay in the surrounding layout), or go full-bleed: put the title and timeline on the screen layer over the moving picture and give <Canvas safe={[top, right, bottom, left]}> the covered bands so targeted framings land in the clear part. Full-bleed lets a push-in fill the whole frame, which a boxed picture cannot.
120
+
121
+ ## Match cut through the subject (chapter seam)
122
+ One sentence: push in until the recurring object fills the frame, swap the world behind it, pull back to reveal the new world.
123
+ - Use for: era/place/version changes where one object stays the subject (a button through four decades, a product through iterations). At most one signature seam style per piece; reuse it for every chapter seam.
124
+ - Duration and energy: push 1.6–1.9 s, cover held about 1 s (the next action can happen under it), pull-back 2.4–2.8 s; high energy at the swap, calm after.
125
+ - Set-up: put every version of the object with its centre on the same world point and add an invisible lens element there; give the versions one motion key so the new one morphs from the old size.
126
+ - Beat 1 (end of chapter N): camera('lens', { pad: 0, zoom: 8–9, ms: 1800 }); start the next chapter's music here with fadeMs 2000–2600 (J-cut).
127
+ - Beat 2 (first step of chapter N+1): switch the state that swaps the worlds (old interface exit="fade", new interface enter="fade", 800–1000 ms each) and in the same step camera('<new overview>', { ms: 2400–2800 }). The camera curve starts slowly, so the crossfade happens while the object still covers the frame, then the new world opens up. Put the chapter's timeline/scrubber movement and year label change in this same step.
128
+ - Keep (do not downgrade): the shared centre point (otherwise the camera whips across the world at 8× and the old ghost slides away), the slow-start pull-back, and exit/enter on whole interfaces rather than on each child.
129
+ - Known pitfalls: a fine 1-px checker or hairline pattern behind the object shimmers (moiré) at high zoom — use a low-contrast texture; a deep link or timeline jump to beat 2 lands on the settled overview, which is what a viewer jumping chapters wants; verify the seam in the film strip (no red CUT) and at full size with --frames.
130
+ - Reference: examples/button-40-years (features/forty/options/a.tsx, throughTheButton).
131
+
132
+ An older variant moves the object out of its interface into a central arrangement before the next chapter catches it (same motion key, exclusive when). It reads as a transfer beat rather than a cut; verify a mid-flight frame in playback because static sheets show only the declared endpoints.
133
+
134
+ ## A continuous object inside playable chapter interfaces
135
+ Use one motion key for the recurring object and distinct element ids for its location in each mutually exclusive arrangement. Keep exactly one visible instance. Each interface should contain a real native input or declared local reaction: the same picture must make sense both during playback and after the viewer pauses.
136
+
137
+ A useful story holds the message or task constant while the surrounding interface changes. The motion gives continuity; the input, menu and result prove the interaction paradigm. Label canned results explicitly when the audience can type arbitrary requests. Do not imply a model or backend computed a result.
138
+
139
+ For the match-cut transition above, use from for continuity, and the engine's actionEntry: 'after' when a confirmed chapter drag should immediately show the new arrangement. Static storyboards prove layout; observe real playback to verify FLIP travel. If a flight does not appear, check for two visible same-key objects, a replaced Canvas/stage, or a manual jump with animate=false before changing the animation.
140
+
141
+ Keep credits and sources outside the animated object area. Render every chapter and inspect the target frame after seeking; then test real typing, first-input pause, hover/touch, reset, continue and cross-chapter confirmation. A menu temporarily covering content is expected while open; verify it closes before the next action needs that content.
142
+
143
+ ## Pitfalls that make a film feel like slides
144
+ - Holds with a frozen camera: drift is on by default; do not turn it off for reading holds — a 1–8 % eased push is enough. If the film strip still marks STILL, the drift is too weak for that framing (flat UI shows little change); raise zoom or add x/y.
145
+ - Every element using the same entrance: vary by meaning (section 3b) and stagger with enterDelay; let new things start before old ones finish leaving.
146
+ - A whole interface replaced in one frame (when swap without exit/enter) is a hard cut. Give both sides a transition or cover the swap with the subject.
147
+ - Whole-screen white/colour flashes over a still picture look like a stalled player; keep the picture moving under any fade.
148
+
149
+ Common pitfall: For visual explainers, read npx joplo skill content: keep a continuous visual story, storyboard every chapter, film-strip the chain, and verify playback before claiming it works`;
@@ -0,0 +1,45 @@
1
+ import { z } from 'zod';
2
+ /** 进退场预设(D92):每个预设是一个“离场姿态”,进场 = 离场姿态 → 原样,退场 = 原样 → 离场姿态。 */
3
+ export declare const TRANSITIONS: readonly ["fade", "rise", "zoom", "shrink", "wipe", "iris"];
4
+ export type Transition = (typeof TRANSITIONS)[number];
5
+ /** 镜头漂移(D92):落定后继续缓慢推近 / 拉远 / 平移,有终点、非匀速。数字 = 在 ms 内再推近到这个倍数。 */
6
+ export type Drift = number | false | {
7
+ zoom?: number;
8
+ x?: number;
9
+ y?: number;
10
+ ms?: number;
11
+ };
12
+ export type CameraOpts = {
13
+ pad?: number;
14
+ zoom?: number;
15
+ ms?: number;
16
+ drift?: Drift;
17
+ };
18
+ /** Move within the design world; no ids restores the whole world. This factory has no player semantics. */
19
+ export declare const camera: (...args: (string | CameraOpts)[]) => import("@joplo-app/kit/plugin").PluginEffectDef;
20
+ export declare const DriftSchema: z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodNumber, z.ZodObject<{
21
+ zoom: z.ZodOptional<z.ZodNumber>;
22
+ x: z.ZodOptional<z.ZodNumber>;
23
+ y: z.ZodOptional<z.ZodNumber>;
24
+ ms: z.ZodOptional<z.ZodNumber>;
25
+ }, z.core.$strict>]>;
26
+ declare const Frame: z.ZodObject<{
27
+ scenes: z.ZodRecord<z.ZodString, z.ZodObject<{
28
+ camera: z.ZodObject<{
29
+ targets: z.ZodArray<z.ZodString>;
30
+ pad: z.ZodOptional<z.ZodNumber>;
31
+ zoom: z.ZodOptional<z.ZodNumber>;
32
+ ms: z.ZodOptional<z.ZodNumber>;
33
+ drift: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodNumber, z.ZodObject<{
34
+ zoom: z.ZodOptional<z.ZodNumber>;
35
+ x: z.ZodOptional<z.ZodNumber>;
36
+ y: z.ZodOptional<z.ZodNumber>;
37
+ ms: z.ZodOptional<z.ZodNumber>;
38
+ }, z.core.$strict>]>>;
39
+ }, z.core.$strict>;
40
+ }, z.core.$strict>>;
41
+ }, z.core.$strict>;
42
+ export type ContentFrame = z.infer<typeof Frame>;
43
+ declare const content: import("@joplo-app/kit").PluginDef;
44
+ export declare const Canvas: (props: import("@joplo-app/kit").JoploProps) => any;
45
+ export default content;
package/dist/plugin.js ADDED
@@ -0,0 +1,85 @@
1
+ import packageInfo from './version.json' with { type: 'json' };
2
+ import { z } from 'zod';
3
+ import { definePlugin, pluginComponent, pluginEffect } from '@joplo-app/kit/plugin';
4
+ import { studio } from "./theme.js";
5
+ import { skill, patterns } from "./guide.js";
6
+ /** 进退场预设(D92):每个预设是一个“离场姿态”,进场 = 离场姿态 → 原样,退场 = 原样 → 离场姿态。 */
7
+ export const TRANSITIONS = ['fade', 'rise', 'zoom', 'shrink', 'wipe', 'iris'];
8
+ /** Move within the design world; no ids restores the whole world. This factory has no player semantics. */
9
+ export const camera = (...args) => {
10
+ const targets = args.filter((arg) => typeof arg === 'string');
11
+ const options = Object.assign({}, ...args.filter(arg => typeof arg === 'object' && arg !== null));
12
+ return pluginEffect('content', 'camera', { targets, ...options });
13
+ };
14
+ export const DriftSchema = z.union([z.literal(false), z.number().min(.5).max(2), z.strictObject({ zoom: z.number().min(.5).max(2).optional(), x: z.number().min(-2000).max(2000).optional(), y: z.number().min(-2000).max(2000).optional(), ms: z.number().min(500).max(60000).optional() })]);
15
+ const Safe = z.tuple([z.number().min(0).max(2000), z.number().min(0).max(2000), z.number().min(0).max(2000), z.number().min(0).max(2000)]);
16
+ const Camera = z.strictObject({ targets: z.array(z.string()), pad: z.number().min(0).max(2000).optional(), zoom: z.number().min(.1).max(10).optional(), ms: z.number().min(0).max(10000).optional(), drift: DriftSchema.optional() });
17
+ const Frame = z.strictObject({ scenes: z.record(z.string(), z.strictObject({ camera: Camera })) });
18
+ const all = (n) => [n, ...(n.children ?? []).flatMap(all)];
19
+ const content = definePlugin({ skillTopics: { patterns: { description: 'Recipes and individual pitfalls', body: patterns } }, packageName: '@joplo-app/plugin-content',
20
+ id: 'content', title: 'Visual explainers', version: packageInfo.version,
21
+ runtime: new URL(import.meta.url.endsWith('.ts') ? './runtime.tsx' : './runtime.js', import.meta.url),
22
+ components: { Canvas: { doc: 'w, h, view=[1280,800], drift?, safe?=[top,right,bottom,left]; scaled design world with fixed screen children; drift = default camera drift; safe = the view area not covered by screen chrome, where targeted camera() frames land', selfEvident: true } },
23
+ properties: {
24
+ motion: { type: 'string', nonempty: true, attribute: 'data-jp-content-motion' },
25
+ motionDelay: { type: 'number', min: 0, max: 10000, attribute: 'data-jp-content-motion-delay' },
26
+ motionMs: { type: 'number', min: 0, max: 10000, attribute: 'data-jp-content-motion-ms' },
27
+ screen: { type: 'boolean', attribute: 'data-jp-content-screen' },
28
+ enter: { type: 'string', values: [...TRANSITIONS], attribute: 'data-jp-content-enter' },
29
+ enterMs: { type: 'number', min: 0, max: 10000, attribute: 'data-jp-content-enter-ms' },
30
+ enterDelay: { type: 'number', min: 0, max: 10000, attribute: 'data-jp-content-enter-delay' },
31
+ exit: { type: 'string', values: [...TRANSITIONS], attribute: 'data-jp-content-exit' },
32
+ exitMs: { type: 'number', min: 0, max: 10000, attribute: 'data-jp-content-exit-ms' },
33
+ exitDelay: { type: 'number', min: 0, max: 10000, attribute: 'data-jp-content-exit-delay' },
34
+ },
35
+ themes: { studio }, skill,
36
+ schemas: { step: Frame },
37
+ data: { step: { scope: [{ path: ['scenes'], kind: 'map', domain: 'scene', children: [{ path: ['camera', 'targets'], kind: 'values', domain: 'element' }] }] } },
38
+ compile: {
39
+ node(node, ctx) {
40
+ if (node.type !== 'content:Canvas')
41
+ return;
42
+ if (node.props.drift !== undefined && !DriftSchema.safeParse(node.props.drift).success)
43
+ ctx.report('CAMERA_INVALID', `<Canvas drift>: use false, a zoom factor 0.5–2 (e.g. 1.04), or { zoom 0.5–2, x/y −2000–2000 design px, ms 500–60000 }`, node.source);
44
+ if (node.props.safe !== undefined && !Safe.safeParse(node.props.safe).success)
45
+ ctx.report('CAMERA_INVALID', `<Canvas safe>: use [top, right, bottom, left] in design px (each 0–2000), the part of the view your screen chrome covers`, node.source);
46
+ },
47
+ effect(effect, ctx) {
48
+ if (effect.name !== 'camera') {
49
+ ctx.report('PLUGIN_EFFECT_UNKNOWN', `Unknown content effect ${effect.name}`, ctx.source);
50
+ return;
51
+ }
52
+ const parsed = Camera.safeParse(effect.payload);
53
+ if (!parsed.success) {
54
+ ctx.report('CAMERA_INVALID', `camera(…): targets must be strings; pad 0–2000, zoom 0.1–10, ms 0–10000, drift false | 0.5–2 | { zoom 0.5–2, x/y −2000–2000, ms 500–60000 } (${parsed.error.issues.map(i => i.message).join('; ')})`, ctx.source);
55
+ return;
56
+ }
57
+ const value = parsed.data;
58
+ const nodes = ctx.roots.flatMap(all);
59
+ const missing = value.targets.filter(id => !nodes.some(n => n.id === id));
60
+ if (missing.length) {
61
+ ctx.report('CAMERA_UNKNOWN', `camera(${missing.map(m => JSON.stringify(m)).join(', ')}) target is not in any layer or the stage for this step; aim it at elements inside a <Canvas>`, ctx.source);
62
+ return;
63
+ }
64
+ return {
65
+ writes: [{ path: 'ui.__plugins.content.camera', value }],
66
+ references: value.targets,
67
+ ...(value.targets.length ? { directorTarget: value.targets[0] } : {}),
68
+ };
69
+ },
70
+ frame(ctx) {
71
+ const scenes = ctx.scenes.filter(s => all(s.root).some(n => n.type === 'content:Canvas'));
72
+ if (!scenes.length)
73
+ return;
74
+ const value = ctx.state.ui.__plugins?.content?.camera;
75
+ const parsed = Camera.safeParse(value ?? { targets: [] });
76
+ if (!parsed.success) {
77
+ ctx.report('CAMERA_INVALID', 'Invalid content camera state; use camera() with valid options');
78
+ return;
79
+ }
80
+ return { scenes: Object.fromEntries(scenes.map(s => [s.id, { camera: { ...parsed.data, targets: parsed.data.targets.filter(id => all(s.root).some(n => n.id === id)) } }])) };
81
+ },
82
+ },
83
+ });
84
+ export const Canvas = pluginComponent(content, 'Canvas');
85
+ export default content;
@@ -0,0 +1,88 @@
1
+ import { type PluginObserve } from '@joplo-app/kit/plugin';
2
+ type Box = {
3
+ x: number;
4
+ y: number;
5
+ w: number;
6
+ h: number;
7
+ };
8
+ type DriftSpec = {
9
+ zoom: number;
10
+ x: number;
11
+ y: number;
12
+ ms: number;
13
+ };
14
+ /** 默认漂移(D92):画面永远不在数学意义上静止——落定后 8 秒内再推近 4%(约 0.5%/s),非匀速、有终点。 */
15
+ export declare const DEFAULT_DRIFT: DriftSpec;
16
+ /** 安全区(D92):view 里不被固定屏幕层(标题、时间轴)盖住的部分;[上, 右, 下, 左] 设计像素。 */
17
+ export type Safe = {
18
+ top: number;
19
+ right: number;
20
+ bottom: number;
21
+ left: number;
22
+ };
23
+ export declare function safeOf(v: unknown): Safe;
24
+ /** 镜头取景:把 r 等比放进 view 的安全区,居中;k 不超过 zoom。 */
25
+ export declare function canvasFrame(r: Box, view: {
26
+ w: number;
27
+ h: number;
28
+ }, zoom?: number, safe?: Safe): {
29
+ k: number;
30
+ tx: number;
31
+ ty: number;
32
+ };
33
+ type Frame = {
34
+ k: number;
35
+ tx: number;
36
+ ty: number;
37
+ };
38
+ /** 镜头的一段:从 from 用 ms 缓动到 to,然后按 drift 继续漂移。时间都是引擎时间(暂停冻结、导出可录)。 */
39
+ export type CameraSegment = {
40
+ from: Frame;
41
+ to: Frame;
42
+ start: number;
43
+ ms: number;
44
+ drift: DriftSpec | null;
45
+ };
46
+ /** cubic-bezier(x1,y1,x2,y2) 的 y(x):牛顿迭代 + 二分兜底。 */
47
+ export declare function bezier(x1: number, y1: number, x2: number, y2: number): (x: number) => number;
48
+ /** 在画面中心(有安全区时是安全区中心)保持不动的前提下,把取景 f 推近 zoom 倍、平移 (x, y)(设计坐标)。 */
49
+ export declare function drifted(f: Frame, d: DriftSpec, q: number, view: {
50
+ w: number;
51
+ h: number;
52
+ cx?: number;
53
+ cy?: number;
54
+ }): Frame;
55
+ /** 镜头在引擎时间 t 的实际取景(含漂移)。 */
56
+ export declare function cameraAt(seg: CameraSegment, t: number, view: {
57
+ w: number;
58
+ h: number;
59
+ cx?: number;
60
+ cy?: number;
61
+ }): Frame;
62
+ /** camera(…, { drift }) 优先,其次 <Canvas drift>,都没写时用 DEFAULT_DRIFT;false 关闭。 */
63
+ export declare function driftOf(camera: unknown, canvas: unknown): DriftSpec | null;
64
+ type Mark = {
65
+ resetKey?: string;
66
+ scenarioId: string;
67
+ position: number;
68
+ playground: boolean;
69
+ };
70
+ /**
71
+ * 跳转(深链、上一步、重置、换章)还是“暂停 → 继续”?两者都会换 resetKey;继续播放时场景与步数不变、之前也没有自由体验。
72
+ * 跳转时画面直接落定,继续时进退场与漂移接着走(D92)。
73
+ */
74
+ export declare function jumpedSince(last: Mark | null, f: {
75
+ resetKey?: string;
76
+ scenarioId: string;
77
+ position: number;
78
+ playground?: boolean;
79
+ }): boolean;
80
+ /**
81
+ * 进退场(D92):每个预设是一个“离场姿态”。进场从离场姿态回到元素自己的样子,退场从元素自己的样子走到离场姿态;
82
+ * 用单个关键帧(另一端是元素的底层样式),不覆盖作者自己的 opacity / transform。
83
+ */
84
+ export declare const AWAY: Record<string, Keyframe>;
85
+ /** One observer per stage: cache only design-space layouts, never player state. */
86
+ export declare const observe: PluginObserve;
87
+ declare const _default: import("@joplo-app/kit/plugin").PluginRuntime;
88
+ export default _default;
@@ -0,0 +1,542 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useLayoutEffect, useRef, useState } from 'react';
3
+ import { defineRuntime } from '@joplo-app/kit/plugin';
4
+ import { useRoot } from '@joplo-app/kit/renderer';
5
+ const stillCss = '.jstage[data-jstill] [data-jcanvas],.jstage[data-jstill] [data-jcanvas] *{transition:none!important;animation-delay:0s!important;animation-duration:0s!important}';
6
+ /** 元素在画布世界里的布局位置(offset 链,不受镜头和变形动画的 transform 影响);不在 root 里时为 null。 */
7
+ function offsetIn(el, root) {
8
+ let x = 0;
9
+ let y = 0;
10
+ let n = el;
11
+ while (n && n !== root) {
12
+ x += n.offsetLeft;
13
+ y += n.offsetTop;
14
+ n = n.offsetParent;
15
+ }
16
+ return n === root ? { x, y, w: el.offsetWidth, h: el.offsetHeight } : null;
17
+ }
18
+ const CAMERA_EASE = 'cubic-bezier(.65,0,.35,1)';
19
+ const MOTION_EASE = 'cubic-bezier(.2,.8,.2,1)';
20
+ const MOTION_MS = 900;
21
+ const numOr = (v, d) => (typeof v === 'number' && Number.isFinite(v) && v > 0 ? v : d);
22
+ /** 默认漂移(D92):画面永远不在数学意义上静止——落定后 8 秒内再推近 4%(约 0.5%/s),非匀速、有终点。 */
23
+ export const DEFAULT_DRIFT = { zoom: 1.04, x: 0, y: 0, ms: 8000 };
24
+ const NO_SAFE = { top: 0, right: 0, bottom: 0, left: 0 };
25
+ export function safeOf(v) {
26
+ if (!Array.isArray(v) || v.length !== 4 || v.some((n) => typeof n !== 'number' || !Number.isFinite(n) || n < 0))
27
+ return NO_SAFE;
28
+ return { top: v[0], right: v[1], bottom: v[2], left: v[3] };
29
+ }
30
+ /** 镜头取景:把 r 等比放进 view 的安全区,居中;k 不超过 zoom。 */
31
+ export function canvasFrame(r, view, zoom = 3, safe = NO_SAFE) {
32
+ const w = Math.max(1, view.w - safe.left - safe.right), h = Math.max(1, view.h - safe.top - safe.bottom);
33
+ const k = Math.min(w / Math.max(1, r.w), h / Math.max(1, r.h), zoom);
34
+ return { k, tx: safe.left + (w - r.w * k) / 2 - r.x * k, ty: safe.top + (h - r.h * k) / 2 - r.y * k };
35
+ }
36
+ /** cubic-bezier(x1,y1,x2,y2) 的 y(x):牛顿迭代 + 二分兜底。 */
37
+ export function bezier(x1, y1, x2, y2) {
38
+ const cx = 3 * x1, bx = 3 * (x2 - x1) - cx, ax = 1 - cx - bx;
39
+ const cy = 3 * y1, by = 3 * (y2 - y1) - cy, ay = 1 - cy - by;
40
+ const sx = (t) => ((ax * t + bx) * t + cx) * t;
41
+ const sy = (t) => ((ay * t + by) * t + cy) * t;
42
+ return (x) => {
43
+ if (x <= 0)
44
+ return 0;
45
+ if (x >= 1)
46
+ return 1;
47
+ let t = x;
48
+ for (let i = 0; i < 6; i++) {
49
+ const d = (3 * ax * t + 2 * bx) * t + cx;
50
+ const e = sx(t) - x;
51
+ if (Math.abs(e) < 1e-6)
52
+ return sy(t);
53
+ if (Math.abs(d) < 1e-6)
54
+ break;
55
+ t -= e / d;
56
+ }
57
+ let lo = 0, hi = 1;
58
+ t = x;
59
+ for (let i = 0; i < 30; i++) {
60
+ const v = sx(t);
61
+ if (Math.abs(v - x) < 1e-6)
62
+ break;
63
+ if (v < x)
64
+ lo = t;
65
+ else
66
+ hi = t;
67
+ t = (lo + hi) / 2;
68
+ }
69
+ return sy(t);
70
+ };
71
+ }
72
+ const cameraEase = bezier(.65, 0, .35, 1);
73
+ /** 漂移的曲线:起步与收尾都是零速度(接在镜头落定之后不顿挫,到终点自然停下),不是匀速。 */
74
+ const driftEase = bezier(.37, 0, .63, 1);
75
+ /** 在画面中心(有安全区时是安全区中心)保持不动的前提下,把取景 f 推近 zoom 倍、平移 (x, y)(设计坐标)。 */
76
+ export function drifted(f, d, q, view) {
77
+ const z = 1 + (d.zoom - 1) * q;
78
+ const ox = view.cx ?? view.w / 2, oy = view.cy ?? view.h / 2;
79
+ const cx = (ox - f.tx) / f.k + d.x * q;
80
+ const cy = (oy - f.ty) / f.k + d.y * q;
81
+ const k = f.k * z;
82
+ return { k, tx: ox - cx * k, ty: oy - cy * k };
83
+ }
84
+ /** 镜头在引擎时间 t 的实际取景(含漂移)。 */
85
+ export function cameraAt(seg, t, view) {
86
+ const p = seg.ms > 0 ? Math.max(0, Math.min(1, (t - seg.start) / seg.ms)) : 1;
87
+ if (p < 1) {
88
+ const e = cameraEase(p);
89
+ return { k: seg.from.k + (seg.to.k - seg.from.k) * e, tx: seg.from.tx + (seg.to.tx - seg.from.tx) * e, ty: seg.from.ty + (seg.to.ty - seg.from.ty) * e };
90
+ }
91
+ if (!seg.drift)
92
+ return seg.to;
93
+ const q = driftEase(Math.max(0, Math.min(1, (t - seg.start - seg.ms) / seg.drift.ms)));
94
+ return q > 0 ? drifted(seg.to, seg.drift, q, view) : seg.to;
95
+ }
96
+ /** camera(…, { drift }) 优先,其次 <Canvas drift>,都没写时用 DEFAULT_DRIFT;false 关闭。 */
97
+ export function driftOf(camera, canvas) {
98
+ const v = camera !== undefined ? camera : canvas !== undefined ? canvas : DEFAULT_DRIFT;
99
+ if (v === false || v === null)
100
+ return null;
101
+ if (typeof v === 'number')
102
+ return Number.isFinite(v) && v !== 1 ? { ...DEFAULT_DRIFT, zoom: v } : null;
103
+ if (typeof v !== 'object')
104
+ return null;
105
+ const o = v;
106
+ const d = { zoom: typeof o.zoom === 'number' ? o.zoom : 1, x: typeof o.x === 'number' ? o.x : 0, y: typeof o.y === 'number' ? o.y : 0, ms: typeof o.ms === 'number' && o.ms > 0 ? o.ms : DEFAULT_DRIFT.ms };
107
+ return d.zoom === 1 && !d.x && !d.y ? null : d;
108
+ }
109
+ /**
110
+ * 跳转(深链、上一步、重置、换章)还是“暂停 → 继续”?两者都会换 resetKey;继续播放时场景与步数不变、之前也没有自由体验。
111
+ * 跳转时画面直接落定,继续时进退场与漂移接着走(D92)。
112
+ */
113
+ export function jumpedSince(last, f) {
114
+ if (!last || last.resetKey === f.resetKey)
115
+ return false;
116
+ return !(last.scenarioId === f.scenarioId && last.position === f.position && !last.playground);
117
+ }
118
+ const markOf = (f) => ({ resetKey: f.resetKey, scenarioId: f.scenarioId, position: f.position, playground: !!f.playground });
119
+ const same = (a, b) => Math.abs(a.k - b.k) <= 1e-4 && Math.abs(a.tx - b.tx) <= 0.5 && Math.abs(a.ty - b.ty) <= 0.5;
120
+ function Canvas({ ctx: context }) {
121
+ const node = context.model;
122
+ const p = context.node.props;
123
+ const ctx = context.frame;
124
+ // screen 子元素固定在屏幕上(设计尺寸,随画布缩放,不随镜头动):章节标记、来源、封面、行动号召
125
+ const kids = node.children ?? [];
126
+ const onScreen = kids.filter((c) => c.props?.screen === true);
127
+ const inWorld = kids.filter((c) => c.props?.screen !== true);
128
+ const viewArr = Array.isArray(p.view) ? p.view : [];
129
+ const view = { w: numOr(viewArr[0], 1280), h: numOr(viewArr[1], 800) };
130
+ const world = { w: numOr(p.w, view.w), h: numOr(p.h, view.h) };
131
+ const { w: _w, h: _h, view: _v, drift: canvasDrift, safe: safeProp, ...rest } = p;
132
+ const safe = safeOf(safeProp);
133
+ // 漂移围绕安全区中心(被叠层盖住的部分不算画面中心)
134
+ const lensView = { ...view, cx: safe.left + (view.w - safe.left - safe.right) / 2, cy: safe.top + (view.h - safe.top - safe.bottom) / 2 };
135
+ // 父元素给了高度(层、h="100%")时铺满;没给高度时 height: 100% 解析为 auto,aspect-ratio 按 view 的比例撑开,不会塌成 0
136
+ const root = useRoot(node, rest, { style: { position: 'relative', width: '100%', height: '100%', aspectRatio: `${view.w} / ${view.h}`, overflow: 'hidden' } });
137
+ const outer = useRef(null);
138
+ const worldRef = useRef(null);
139
+ const [box, setBox] = useState({ w: 0, h: 0 });
140
+ useLayoutEffect(() => {
141
+ const el = outer.current;
142
+ if (!el)
143
+ return;
144
+ const read = () => setBox((b) => (b.w === el.clientWidth && b.h === el.clientHeight ? b : { w: el.clientWidth, h: el.clientHeight }));
145
+ read();
146
+ const ro = new ResizeObserver(read);
147
+ ro.observe(el);
148
+ return () => ro.disconnect();
149
+ }, []);
150
+ // 镜头:编译好的当前舞台取景快照;目标不在这张画布里时看整张画布
151
+ const cam = context.ext.content?.scenes[ctx.sceneId]?.camera;
152
+ const whole = canvasFrame({ x: 0, y: 0, ...world }, view, Infinity);
153
+ const clock = ctx.clock;
154
+ // 引擎时钟驱动(D92):镜头的每一段从“此刻实际的取景”出发,落定后按 drift 漂移;没有时钟的宿主退回 CSS 过渡、不漂移
155
+ const timed = !!clock && ctx.animate;
156
+ const now = clock?.timeMs ?? 0;
157
+ const seg = useRef({ from: whole, to: whole, start: now, ms: 0, drift: null });
158
+ const [, redraw] = useState(0);
159
+ const lastMark = useRef(null);
160
+ const target = useRef(whole);
161
+ const driftKey = useRef('');
162
+ useLayoutEffect(() => {
163
+ const w = worldRef.current;
164
+ if (!w)
165
+ return;
166
+ // 1) 取景:目标的布局范围(offset,不含 transform)合起来,加留白
167
+ let next = whole;
168
+ const ids = cam?.targets ?? [];
169
+ if (ids.length) {
170
+ const boxes = ids.flatMap((id) => {
171
+ const el = w.querySelector(`[data-jid="${CSS.escape(id)}"]`);
172
+ const b = el ? offsetIn(el, w) : null;
173
+ return b ? [b] : [];
174
+ });
175
+ if (boxes.length) {
176
+ const pad = cam?.pad ?? 48;
177
+ const x0 = Math.min(...boxes.map((b) => b.x)) - pad;
178
+ const y0 = Math.min(...boxes.map((b) => b.y)) - pad;
179
+ const x1 = Math.max(...boxes.map((b) => b.x + b.w)) + pad;
180
+ const y1 = Math.max(...boxes.map((b) => b.y + b.h)) + pad;
181
+ next = canvasFrame({ x: x0, y: y0, w: x1 - x0, h: y1 - y0 }, view, cam?.zoom ?? 3, safe);
182
+ }
183
+ }
184
+ const drift = timed ? driftOf(cam?.drift, canvasDrift) : null;
185
+ const dk = JSON.stringify(drift);
186
+ const camMoves = !same(target.current, next);
187
+ const mounted = lastMark.current !== null;
188
+ const jumped = jumpedSince(lastMark.current, ctx);
189
+ lastMark.current = markOf(ctx);
190
+ // 时钟停了(不是暂停)而镜头段还没走完:直接落到目标,不卡在半路(D97:手动单步的收尾比作者写的 ms 短时)
191
+ const stranded = timed && !!clock && !clock.running && !clock.paused && seg.current.ms > 0 && now < seg.current.start + seg.current.ms;
192
+ if (camMoves || jumped || !mounted || stranded || dk !== driftKey.current || !timed && seg.current.drift) {
193
+ target.current = next;
194
+ driftKey.current = dk;
195
+ // 只有连续播放中(时钟在走、已经挂载过、不是跳转)才补间;首次挂载、停止状态、跳转、截图与静态画面直接落定(D92 R1)。
196
+ // 暂停时目标不会变,已有的镜头段原样冻结。
197
+ const glide = timed && camMoves && !jumped && mounted && !!clock?.running;
198
+ const from = glide ? cameraAt(seg.current, now, lensView) : next;
199
+ seg.current = { from, to: next, start: now, ms: glide ? cam?.ms ?? 1200 : 0, drift };
200
+ redraw((n) => n + 1);
201
+ }
202
+ // 镜头同一步也在动:变形用镜头的时长与缓动,两者同步落定(否则屏幕上的轨迹会先冲过头再折回)
203
+ const flight = camMoves && ctx.animate ? { ms: cam?.ms ?? 1200, ease: CAMERA_EASE } : { ms: MOTION_MS, ease: MOTION_EASE };
204
+ w.dataset.flightMs = String(flight.ms);
205
+ w.dataset.flightEase = flight.ease;
206
+ });
207
+ const s = box.w && box.h ? Math.min(box.w / view.w, box.h / view.h) : 0;
208
+ const ox = (box.w - view.w * s) / 2;
209
+ const oy = (box.h - view.h * s) / 2;
210
+ const frame = timed ? cameraAt(seg.current, now, lensView) : seg.current.to;
211
+ const ms = cam?.ms ?? 1200;
212
+ return (_jsxs("div", { ...root, children: [_jsx("style", { children: stillCss }), _jsxs("div", { ref: outer, style: { position: 'absolute', inset: 0 }, "data-jcanvas": "", "data-jreport-surface": "Canvas", children: [_jsx("div", { ref: worldRef, "data-jcanvas-world": "", "data-jreport-viewport": "", style: {
213
+ position: 'absolute', left: 0, top: 0, width: world.w, height: world.h, transformOrigin: '0 0',
214
+ visibility: s ? 'visible' : 'hidden',
215
+ transform: `translate(${ox + frame.tx * s}px, ${oy + frame.ty * s}px) scale(${frame.k * s})`,
216
+ transition: !timed && ctx.animate && !clock ? `transform ${ms}ms ${CAMERA_EASE}` : 'none',
217
+ }, children: context.renderChildren(inWorld) }), onScreen.length ? (_jsx("div", { "data-jcanvas-screen": "", style: { position: 'absolute', left: ox, top: oy, width: view.w, height: view.h, transformOrigin: '0 0', transform: `scale(${s})`, visibility: s ? 'visible' : 'hidden', pointerEvents: 'none' }, children: onScreen.map((c) => _jsx("div", { style: { pointerEvents: 'auto' }, children: context.renderChildren([c]) }, c.id)) })) : null] })] }));
218
+ }
219
+ /**
220
+ * 进退场(D92):每个预设是一个“离场姿态”。进场从离场姿态回到元素自己的样子,退场从元素自己的样子走到离场姿态;
221
+ * 用单个关键帧(另一端是元素的底层样式),不覆盖作者自己的 opacity / transform。
222
+ */
223
+ export const AWAY = {
224
+ fade: { opacity: 0 },
225
+ rise: { opacity: 0, translate: '0 18%' },
226
+ zoom: { opacity: 0, scale: '1.16' },
227
+ shrink: { opacity: 0, scale: '.84' },
228
+ wipe: { clipPath: 'inset(0 100% 0 0)' },
229
+ iris: { clipPath: 'circle(0% at 50% 50%)' },
230
+ };
231
+ const ENTER_EASE = 'cubic-bezier(.16,1,.3,1)';
232
+ const EXIT_EASE = 'cubic-bezier(.55,0,.75,.2)';
233
+ const ENTER_MS = 600;
234
+ const EXIT_MS = 450;
235
+ const msOf = (v, d) => (v === undefined || v === '' || !Number.isFinite(Number(v)) ? d : Math.max(0, Number(v)));
236
+ /** 幽灵不带身份:不能被镜头、FLIP、检查、提示、无障碍树或键盘找到。 */
237
+ const IDENTITY = ['id', 'name', 'for', 'tabindex', 'autofocus', 'contenteditable', 'data-jid', 'data-jinteractive', 'data-jhover'];
238
+ function strip(el) {
239
+ for (const n of [el, ...el.querySelectorAll('*')]) {
240
+ for (const a of IDENTITY)
241
+ n.removeAttribute(a);
242
+ for (const a of [...n.getAttributeNames()])
243
+ if (a.startsWith('data-jp-content-'))
244
+ n.removeAttribute(a);
245
+ }
246
+ }
247
+ /** 克隆不带表单的实时值与画布像素:从(已卸载的)原元素抄过来,外观与移除前一致。 */
248
+ function copyLive(from, to) {
249
+ const a = [from, ...from.querySelectorAll('*')], b = [to, ...to.querySelectorAll('*')];
250
+ a.forEach((src, i) => {
251
+ const dst = b[i];
252
+ if (!dst)
253
+ return;
254
+ if (src instanceof HTMLInputElement && dst instanceof HTMLInputElement) {
255
+ dst.value = src.value;
256
+ dst.checked = src.checked;
257
+ }
258
+ else if ((src instanceof HTMLTextAreaElement || src instanceof HTMLSelectElement) && (dst instanceof HTMLTextAreaElement || dst instanceof HTMLSelectElement))
259
+ dst.value = src.value;
260
+ else if (src instanceof HTMLCanvasElement && dst instanceof HTMLCanvasElement) {
261
+ try {
262
+ dst.getContext('2d')?.drawImage(src, 0, 0);
263
+ }
264
+ catch { /* tainted / zero-size */ }
265
+ }
266
+ });
267
+ }
268
+ /** One observer per stage: cache only design-space layouts, never player state. */
269
+ export const observe = (root, initial) => {
270
+ const context0Inputs = initial?.frame.inputs;
271
+ const layouts = new Map();
272
+ const clips = new Map();
273
+ // FLIP crosses containers; their normal overflow must not clip that travel.
274
+ const lift = (el, world) => {
275
+ const held = [];
276
+ for (let p = el.parentElement; p && p !== world; p = p.parentElement) {
277
+ const existing = clips.get(p);
278
+ const css = getComputedStyle(p);
279
+ if (!existing && ![css.overflowX, css.overflowY].some(v => ['hidden', 'clip', 'auto', 'scroll'].includes(v)))
280
+ continue;
281
+ const entry = existing ?? { count: 0, value: p.style.getPropertyValue('overflow'), priority: p.style.getPropertyPriority('overflow') };
282
+ entry.count++;
283
+ clips.set(p, entry);
284
+ held.push(p);
285
+ p.style.setProperty('overflow', 'visible', 'important');
286
+ }
287
+ return () => {
288
+ for (const p of held) {
289
+ const entry = clips.get(p);
290
+ if (!entry || --entry.count > 0)
291
+ continue;
292
+ if (entry.value)
293
+ p.style.setProperty('overflow', entry.value, entry.priority);
294
+ else
295
+ p.style.removeProperty('overflow');
296
+ clips.delete(p);
297
+ }
298
+ };
299
+ };
300
+ const flights = new Map();
301
+ const forget = (a) => { flights.get(a)?.release?.(); flights.delete(a); };
302
+ const cancel = (w) => { for (const el of w.querySelectorAll('[data-jp-content-motion]'))
303
+ for (const a of el.getAnimations?.() ?? [])
304
+ if (a.id === 'jmotion')
305
+ a.cancel(); };
306
+ // ---- 进退场(D92)----
307
+ // 退场的幽灵:被 React 移除的元素的克隆,放回原来的父元素、原来的位置(同样的选择器上下文),绝对定位在移除前的布局上,
308
+ // 播完退场动画就删掉。React 只操作它自己创建的节点,幽灵不在它的树里。
309
+ const ghosts = new Map();
310
+ const entering = new Set();
311
+ const exitBoxes = new Map();
312
+ const present = new WeakSet();
313
+ const watchers = new Map();
314
+ let quiet = true;
315
+ let last = null;
316
+ let lastInputs = context0Inputs;
317
+ const drop = (outer) => { ghosts.delete(outer); outer.remove(); };
318
+ /** 落定:进场直接到终态、幽灵立刻消失(跳转、自由体验、停止、截图、组件卸载)。 */
319
+ const settle = () => {
320
+ for (const [outer, a] of [...ghosts]) {
321
+ a?.cancel();
322
+ drop(outer);
323
+ }
324
+ for (const a of [...entering]) {
325
+ entering.delete(a);
326
+ a.cancel();
327
+ }
328
+ };
329
+ const ghostOf = (el, removed, parent, next, world) => {
330
+ const box = exitBoxes.get(world)?.get(el);
331
+ const kind = el.dataset.jpContentExit ?? '';
332
+ if (!box || !AWAY[kind] || typeof el.animate !== 'function')
333
+ return;
334
+ // 同一个 motion 键在新画面里还在:交给 FLIP(以变形为准,不叠加退场)
335
+ const key = el.dataset.jpContentMotion;
336
+ if (key && world.querySelector(`[data-jp-content-motion="${CSS.escape(key)}"]`))
337
+ return;
338
+ if (!(parent instanceof HTMLElement) || !parent.isConnected || !world.contains(parent))
339
+ return;
340
+ const ghost = el.cloneNode(true);
341
+ copyLive(el, ghost);
342
+ let outer = ghost;
343
+ // 一起被移除的祖先(el 在被移除的子树里面):只留 display: contents 的外壳,选择器与继承的样式照旧,不产生盒子
344
+ for (let a = el === removed ? null : el.parentElement; a; a = a === removed ? null : a.parentElement) {
345
+ const shell = a.cloneNode(false);
346
+ shell.style.setProperty('display', 'contents', 'important');
347
+ shell.append(outer);
348
+ outer = shell;
349
+ }
350
+ strip(outer);
351
+ outer.setAttribute('data-jghost', '');
352
+ outer.setAttribute('aria-hidden', 'true');
353
+ outer.inert = true;
354
+ const put = (k, v) => ghost.style.setProperty(k, v, 'important');
355
+ put('position', 'absolute');
356
+ put('left', '0px');
357
+ put('top', '0px');
358
+ put('margin', '0px');
359
+ put('box-sizing', 'border-box');
360
+ put('width', `${box.w}px`);
361
+ put('height', `${box.h}px`);
362
+ put('pointer-events', 'none');
363
+ parent.insertBefore(outer, next && next.parentNode === parent ? next : null);
364
+ const origin = offsetIn(ghost, world);
365
+ if (!origin) {
366
+ outer.remove();
367
+ return;
368
+ }
369
+ put('left', `${box.x - origin.x}px`);
370
+ put('top', `${box.y - origin.y}px`);
371
+ const anim = ghost.animate([{ ...AWAY[kind], offset: 1 }], { duration: msOf(el.dataset.jpContentExitMs, EXIT_MS), delay: msOf(el.dataset.jpContentExitDelay, 0), easing: EXIT_EASE, fill: 'forwards' });
372
+ anim.id = 'jexit';
373
+ ghosts.set(outer, anim);
374
+ const done = () => { if (ghosts.get(outer) === anim)
375
+ drop(outer); };
376
+ anim.addEventListener('finish', done, { once: true });
377
+ anim.addEventListener('cancel', done, { once: true });
378
+ };
379
+ const handle = (records, world) => {
380
+ for (const r of records)
381
+ for (const n of r.removedNodes) {
382
+ if (!(n instanceof HTMLElement) || n.isConnected || ghosts.has(n) || n.hasAttribute('data-jghost') || quiet)
383
+ continue;
384
+ const marked = [...(n.hasAttribute('data-jp-content-exit') ? [n] : []), ...n.querySelectorAll('[data-jp-content-exit]')];
385
+ for (const el of marked) {
386
+ let outermost = true;
387
+ for (let a = el === n ? null : el.parentElement; a; a = a === n ? null : a.parentElement)
388
+ if (a.hasAttribute('data-jp-content-exit')) {
389
+ outermost = false;
390
+ break;
391
+ }
392
+ if (outermost)
393
+ ghostOf(el, n, r.target, r.nextSibling, world);
394
+ }
395
+ }
396
+ };
397
+ const watch = (w) => {
398
+ if (watchers.has(w) || typeof MutationObserver === 'undefined')
399
+ return;
400
+ const mo = new MutationObserver((records) => handle(records, w));
401
+ mo.observe(w, { childList: true, subtree: true });
402
+ watchers.set(w, mo);
403
+ };
404
+ return {
405
+ update(context) {
406
+ const f = context.frame;
407
+ const running = !f.clock || f.clock.running;
408
+ const jumped = jumpedSince(last, f);
409
+ // 观众刚在舞台上输入(D92 R6):先落定进退场,再让输入作用在终态画面上;播放器的普通暂停不改变 inputs,仍冻结
410
+ const touched = f.inputs !== undefined && f.inputs !== lastInputs;
411
+ lastInputs = f.inputs;
412
+ quiet = !f.animate || !!f.playground || !running || jumped || touched;
413
+ // 暂停:保持冻结(引擎时钟不走);其余安静的情况一律落定
414
+ if (!f.animate || f.playground || jumped || touched || (!running && !f.clock?.paused))
415
+ settle();
416
+ last = markOf(f);
417
+ // 这次提交里被移除的节点同步处理:此刻的布局缓存还是移除前的
418
+ for (const [w, mo] of watchers)
419
+ handle(mo.takeRecords(), w);
420
+ for (const [outer] of ghosts)
421
+ if (!outer.isConnected)
422
+ ghosts.delete(outer);
423
+ for (const [animation, flight] of flights) {
424
+ if (!context.frame.animate || !root.contains(flight.el)) {
425
+ animation.cancel();
426
+ forget(animation);
427
+ continue;
428
+ }
429
+ if (context.frame.playground && animation.effect) {
430
+ // Keep the animation identity/time anchor, but yield its transform to
431
+ // the editable final layout. Restoring the effect resumes one clock.
432
+ animation.effect = null;
433
+ flight.release?.();
434
+ flight.release = null;
435
+ }
436
+ else if (!context.frame.playground && !animation.effect) {
437
+ animation.effect = flight.effect;
438
+ flight.release = lift(flight.el, flight.world);
439
+ }
440
+ }
441
+ // 画布世界与固定屏幕层(screen 子元素:时间轴、角标)都是“表面”:进退场与变形在两者里都生效,镜头只动世界
442
+ const worlds = [...root.querySelectorAll('[data-jcanvas-world],[data-jcanvas-screen]')];
443
+ for (const w of layouts.keys())
444
+ if (!worlds.includes(w)) {
445
+ cancel(w);
446
+ layouts.delete(w);
447
+ exitBoxes.delete(w);
448
+ watchers.get(w)?.disconnect();
449
+ watchers.delete(w);
450
+ }
451
+ for (const w of worlds) {
452
+ const fresh = !layouts.has(w);
453
+ watch(w);
454
+ const previous = layouts.get(w) ?? new Map();
455
+ const flight = { ms: Number(w.dataset.flightMs ?? MOTION_MS), ease: w.dataset.flightEase ?? MOTION_EASE };
456
+ // 2) 变形(FLIP):同一个 motion 键的布局位置变了 → 从旧位置、旧大小补间到新位置
457
+ const seen = new Map(previous);
458
+ for (const el of w.querySelectorAll('[data-jp-content-motion]')) {
459
+ const key = el.dataset.jpContentMotion;
460
+ const r = offsetIn(el, w);
461
+ if (!r)
462
+ continue;
463
+ const prev = previous.get(key);
464
+ seen.set(key, r);
465
+ if (!context.frame.animate) {
466
+ for (const a of el.getAnimations?.() ?? [])
467
+ if (a.id === 'jmotion')
468
+ a.cancel();
469
+ }
470
+ // 跳转、停止后的提交与静态画面直接显示新布局(D92):变形飞行只属于连续播放
471
+ if (!prev || !context.frame.animate || context.frame.playground || quiet) {
472
+ if (quiet)
473
+ for (const a of el.getAnimations?.() ?? [])
474
+ if (a.id === 'jmotion')
475
+ a.cancel();
476
+ continue;
477
+ }
478
+ if (Math.abs(prev.x - r.x) < 0.5 && Math.abs(prev.y - r.y) < 0.5 && Math.abs(prev.w - r.w) < 0.5 && Math.abs(prev.h - r.h) < 0.5)
479
+ continue;
480
+ const dx = prev.x + prev.w / 2 - (r.x + r.w / 2);
481
+ const dy = prev.y + prev.h / 2 - (r.y + r.h / 2);
482
+ const sx = r.w > 0 && prev.w > 0 ? prev.w / r.w : 1;
483
+ const sy = r.h > 0 && prev.h > 0 ? prev.h / r.h : 1;
484
+ for (const a of el.getAnimations())
485
+ if (a.id === 'jmotion')
486
+ a.cancel();
487
+ if (typeof el.animate !== 'function')
488
+ continue;
489
+ const anim = el.animate([{ translate: `${dx}px ${dy}px`, scale: `${sx} ${sy}` }, { translate: '0px 0px', scale: '1 1' }], { duration: el.dataset.jpContentMotionMs === undefined ? flight.ms : Number(el.dataset.jpContentMotionMs), easing: flight.ease, delay: Number(el.dataset.jpContentMotionDelay) || 0, fill: 'backwards' });
490
+ anim.id = 'jmotion';
491
+ flights.set(anim, { el, world: w, effect: anim.effect, release: lift(el, w) });
492
+ anim.addEventListener('finish', () => forget(anim), { once: true });
493
+ anim.addEventListener('cancel', () => forget(anim), { once: true });
494
+ }
495
+ // 3) 进场:第一次出现的元素(新的 DOM 节点)。画布刚出现、安静的提交、FLIP 接管的同键元素都不播
496
+ for (const el of w.querySelectorAll('[data-jp-content-enter]')) {
497
+ if (present.has(el))
498
+ continue;
499
+ present.add(el);
500
+ const kind = el.dataset.jpContentEnter ?? '';
501
+ if (fresh || quiet || !AWAY[kind] || typeof el.animate !== 'function' || el.closest('[data-jghost]'))
502
+ continue;
503
+ const key = el.dataset.jpContentMotion;
504
+ if (key && previous.has(key))
505
+ continue;
506
+ const anim = el.animate([{ ...AWAY[kind], offset: 0 }], { duration: msOf(el.dataset.jpContentEnterMs, ENTER_MS), delay: msOf(el.dataset.jpContentEnterDelay, 0), easing: ENTER_EASE, fill: 'backwards' });
507
+ anim.id = 'jenter';
508
+ entering.add(anim);
509
+ anim.addEventListener('finish', () => entering.delete(anim), { once: true });
510
+ anim.addEventListener('cancel', () => entering.delete(anim), { once: true });
511
+ }
512
+ // 4) 退场要用的布局:每次提交后记下带 exit 的元素此刻的位置大小(被移除时它已经量不到了)
513
+ const boxes = new Map();
514
+ for (const el of w.querySelectorAll('[data-jp-content-exit]')) {
515
+ if (el.closest('[data-jghost]'))
516
+ continue;
517
+ const b = offsetIn(el, w);
518
+ if (b)
519
+ boxes.set(el, b);
520
+ }
521
+ exitBoxes.set(w, boxes);
522
+ if (!context.frame.playground)
523
+ layouts.set(w, seen);
524
+ }
525
+ },
526
+ destroy() {
527
+ settle();
528
+ for (const mo of watchers.values())
529
+ mo.disconnect();
530
+ watchers.clear();
531
+ for (const [animation] of flights) {
532
+ animation.cancel();
533
+ forget(animation);
534
+ }
535
+ for (const w of layouts.keys())
536
+ cancel(w);
537
+ layouts.clear();
538
+ exitBoxes.clear();
539
+ },
540
+ };
541
+ };
542
+ export default defineRuntime({ id: 'content', observe, components: { Canvas: { react: Canvas } } });
@@ -0,0 +1 @@
1
+ export declare const studio = "/* \u8BB2\u89E3\u7C7B\u89C6\u9891\u98CE\u683C\uFF1A\u6DF1\u975B\u84DD\u821E\u53F0\u3001\u6696\u767D\u6587\u5B57\u3001\u4E00\u4E2A\u7425\u73C0\u8272\u5F3A\u8C03\u8272\u3001\u65E0\u624B\u7ED8\u63CF\u8FB9\u3002 */\n:root {\n --jp-font: \"PingFang SC\", \"Noto Sans SC\", \"Inter\", \"Helvetica Neue\", system-ui, sans-serif;\n --jp-font-mono: \"JetBrains Mono\", \"SF Mono\", ui-monospace, monospace;\n --jp-ink: #f3f1ec;\n --jp-bg: #0d1020;\n --jp-surface: #161a30;\n --jp-subtle: #1c2140;\n --jp-muted: #9aa3c0;\n --jp-faint: #5c6485;\n --jp-line: #262c4d;\n --jp-line-strong: #3a4270;\n --jp-border: #2e355c;\n --jp-accent: #ffb020;\n --jp-select: #ffb020;\n --jp-info: #5b8cff;\n --jp-ok: #34d399;\n --jp-warn: #ffb020;\n --jp-danger: #ff6b6b;\n --jp-radius: 10px;\n --jp-shadow: 0 12px 32px rgba(0, 0, 0, .45);\n --jp-stroke: clean;\n}\n\n/* \u51FA\u573A\u52A8\u753B\uFF08\u4F5C\u8005\u5143\u7D20\u7528 className \u5F15\u7528\uFF09\uFF1A\u9759\u6001\u753B\u9762\u91CC Joplo \u4F1A\u76F4\u63A5\u663E\u793A\u7EC8\u6001 */\n@keyframes x-pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }\n@keyframes x-fade { from { opacity: 0; } to { opacity: 1; } }\n@keyframes x-flip { from { transform: perspective(600px) rotateY(90deg); } to { transform: none; } }\n@keyframes x-rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }\n.x-pop { animation: x-pop 500ms cubic-bezier(.2, .8, .2, 1) both; }\n.x-fade { animation: x-fade 600ms ease both; }\n.x-flip { animation: x-flip 650ms cubic-bezier(.2, .8, .2, 1) both; }\n.x-rise { animation: x-rise 600ms cubic-bezier(.2, .8, .2, 1) both; }\n/* \u9010\u5B57\u51FA\u73B0\uFF1A\u6BCF\u4E2A\u5B57\u4E00\u4E2A x-type\uFF0Canimation-delay \u6309\u5E8F\u53F7\u9519\u5F00 */\n.x-type { animation: x-fade 80ms linear both; }\n";
package/dist/theme.js ADDED
@@ -0,0 +1,36 @@
1
+ export const studio = `/* 讲解类视频风格:深靛蓝舞台、暖白文字、一个琥珀色强调色、无手绘描边。 */
2
+ :root {
3
+ --jp-font: "PingFang SC", "Noto Sans SC", "Inter", "Helvetica Neue", system-ui, sans-serif;
4
+ --jp-font-mono: "JetBrains Mono", "SF Mono", ui-monospace, monospace;
5
+ --jp-ink: #f3f1ec;
6
+ --jp-bg: #0d1020;
7
+ --jp-surface: #161a30;
8
+ --jp-subtle: #1c2140;
9
+ --jp-muted: #9aa3c0;
10
+ --jp-faint: #5c6485;
11
+ --jp-line: #262c4d;
12
+ --jp-line-strong: #3a4270;
13
+ --jp-border: #2e355c;
14
+ --jp-accent: #ffb020;
15
+ --jp-select: #ffb020;
16
+ --jp-info: #5b8cff;
17
+ --jp-ok: #34d399;
18
+ --jp-warn: #ffb020;
19
+ --jp-danger: #ff6b6b;
20
+ --jp-radius: 10px;
21
+ --jp-shadow: 0 12px 32px rgba(0, 0, 0, .45);
22
+ --jp-stroke: clean;
23
+ }
24
+
25
+ /* 出场动画(作者元素用 className 引用):静态画面里 Joplo 会直接显示终态 */
26
+ @keyframes x-pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
27
+ @keyframes x-fade { from { opacity: 0; } to { opacity: 1; } }
28
+ @keyframes x-flip { from { transform: perspective(600px) rotateY(90deg); } to { transform: none; } }
29
+ @keyframes x-rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
30
+ .x-pop { animation: x-pop 500ms cubic-bezier(.2, .8, .2, 1) both; }
31
+ .x-fade { animation: x-fade 600ms ease both; }
32
+ .x-flip { animation: x-flip 650ms cubic-bezier(.2, .8, .2, 1) both; }
33
+ .x-rise { animation: x-rise 600ms cubic-bezier(.2, .8, .2, 1) both; }
34
+ /* 逐字出现:每个字一个 x-type,animation-delay 按序号错开 */
35
+ .x-type { animation: x-fade 80ms linear both; }
36
+ `;
@@ -0,0 +1,3 @@
1
+ {
2
+ "version": "0.4.1"
3
+ }
package/package.json CHANGED
@@ -1,6 +1,52 @@
1
1
  {
2
2
  "name": "@joplo-app/plugin-content",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.4.1",
4
+ "type": "module",
5
+ "joplo": {
6
+ "api": 2
7
+ },
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/plugin.d.ts",
11
+ "default": "./dist/plugin.js"
12
+ },
13
+ "./runtime": {
14
+ "types": "./dist/runtime.d.ts",
15
+ "default": "./dist/runtime.js"
16
+ },
17
+ "./guide": {
18
+ "types": "./dist/guide.d.ts",
19
+ "default": "./dist/guide.js"
20
+ },
21
+ "./package.json": "./package.json"
22
+ },
23
+ "dependencies": {
24
+ "zod": "4.6.7",
25
+ "@joplo-app/kit": "0.4.1",
26
+ "react": "19.3.1"
27
+ },
28
+ "devDependencies": {
29
+ "@types/react": "^19.3.0",
30
+ "react-dom": "19.3.1",
31
+ "@types/react-dom": "^19.3.0"
32
+ },
33
+ "description": "Joplo first-party visual explainers, camera and motion",
34
+ "license": "PolyForm-Shield-1.0.0",
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "git+https://github.com/Joplo-app/Joplo.git",
38
+ "directory": "plugins/content"
39
+ },
40
+ "engines": {
41
+ "node": ">=22"
42
+ },
43
+ "files": [
44
+ "dist"
45
+ ],
46
+ "publishConfig": {
47
+ "access": "public"
48
+ },
49
+ "scripts": {
50
+ "build": "node ../../scripts/build-package.mjs"
51
+ }
6
52
  }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.