@litfamily/litcodex 1.0.30 → 1.0.32
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/README-Ko-KR.md +13 -12
- package/README.md +13 -12
- package/TRADEMARK.md +12 -0
- package/dist/install/generated-skill-payload-hashes.d.ts +188 -82
- package/dist/install/generated-skill-payload-hashes.js +188 -82
- package/dist/install/skill-catalog.d.ts +1 -1
- package/dist/install/skill-catalog.js +12 -1
- package/dist/install/skill-resource-hashes.d.ts +1 -1
- package/dist/install/skill-resource-hashes.js +1 -1
- package/marketplace/plugins/litcodex/.codex-plugin/plugin.json +1 -1
- package/marketplace/plugins/litcodex/components/auto-update/package.json +1 -1
- package/marketplace/plugins/litcodex/components/comment-checker/package.json +1 -1
- package/marketplace/plugins/litcodex/components/git-bash/package.json +1 -1
- package/marketplace/plugins/litcodex/components/lit-loop/directive.md +10 -4
- package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-adhd.md +194 -0
- package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-handoff.md +2 -0
- package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-hijack.md +219 -0
- package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-plan.md +2 -1
- package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-recap.md +2 -0
- package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-schematic.md +199 -0
- package/marketplace/plugins/litcodex/components/lit-loop/directives/litwork.md +2 -1
- package/marketplace/plugins/litcodex/components/lit-loop/dist/adhd-suggest.d.ts +10 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/adhd-suggest.js +67 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/card-html.d.ts +1 -1
- package/marketplace/plugins/litcodex/components/lit-loop/dist/card-html.js +128 -8
- package/marketplace/plugins/litcodex/components/lit-loop/dist/card-looks.d.ts +19 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/card-looks.js +58 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/card-status.d.ts +30 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/card-status.js +97 -7
- package/marketplace/plugins/litcodex/components/lit-loop/dist/cli.js +13 -3
- package/marketplace/plugins/litcodex/components/lit-loop/dist/codex-hook.d.ts +2 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/codex-hook.js +8 -9
- package/marketplace/plugins/litcodex/components/lit-loop/dist/control-chars.d.ts +5 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/control-chars.js +23 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/hook-cli.d.ts +8 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/hook-cli.js +126 -13
- package/marketplace/plugins/litcodex/components/lit-loop/dist/hud.d.ts +1 -1
- package/marketplace/plugins/litcodex/components/lit-loop/dist/hud.js +29 -13
- package/marketplace/plugins/litcodex/components/lit-loop/dist/lane-events.d.ts +13 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/lane-events.js +85 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/lane-state.d.ts +55 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/lane-state.js +227 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/live-step.d.ts +5 -1
- package/marketplace/plugins/litcodex/components/lit-loop/dist/live-step.js +17 -1
- package/marketplace/plugins/litcodex/components/lit-loop/dist/markers.d.ts +6 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/markers.js +6 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/modes.d.ts +1 -1
- package/marketplace/plugins/litcodex/components/lit-loop/dist/modes.js +25 -1
- package/marketplace/plugins/litcodex/components/lit-loop/dist/motion-gate.d.ts +79 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/motion-gate.js +310 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/motion-route.js +5 -1
- package/marketplace/plugins/litcodex/components/lit-loop/dist/plan-persistence.d.ts +1 -1
- package/marketplace/plugins/litcodex/components/lit-loop/dist/plan-persistence.js +38 -2
- package/marketplace/plugins/litcodex/components/lit-loop/dist/plan-scope-roots.d.ts +7 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/plan-scope-roots.js +76 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/redaction.js +18 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/reentry.d.ts +15 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/reentry.js +46 -9
- package/marketplace/plugins/litcodex/components/lit-loop/dist/restart-chip.d.ts +6 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/restart-chip.js +59 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-cli.d.ts +10 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-cli.js +88 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-go.d.ts +20 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-go.js +94 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-look.d.ts +6 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-look.js +41 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-redact.d.ts +3 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-redact.js +40 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-rollout.d.ts +48 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-rollout.js +292 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind.d.ts +168 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind.js +867 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/route-heads.js +45 -3
- package/marketplace/plugins/litcodex/components/lit-loop/dist/run-panel.js +1 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/schematic-route.d.ts +6 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/schematic-route.js +35 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/screen-card.d.ts +3 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/screen-card.js +15 -5
- package/marketplace/plugins/litcodex/components/lit-loop/dist/session-liveness.d.ts +16 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/session-liveness.js +90 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-mention-scope.js +6 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/stack-hook.d.ts +8 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/stack-hook.js +57 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/statusline.js +8 -3
- package/marketplace/plugins/litcodex/components/lit-loop/dist/threads.d.ts +50 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/threads.js +183 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/trigger.d.ts +1 -1
- package/marketplace/plugins/litcodex/components/lit-loop/dist/trigger.js +29 -5
- package/marketplace/plugins/litcodex/components/lit-loop/dist/workflow-map.d.ts +10 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/workflow-map.js +11 -1
- package/marketplace/plugins/litcodex/components/lit-loop/dist/workflow-stack.d.ts +139 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/workflow-stack.js +518 -0
- package/marketplace/plugins/litcodex/components/lit-loop/package.json +1 -1
- package/marketplace/plugins/litcodex/components/lsp/package.json +1 -1
- package/marketplace/plugins/litcodex/components/rules/package.json +1 -1
- package/marketplace/plugins/litcodex/components/start-work-continuation/dist/codex-hook.d.ts +6 -0
- package/marketplace/plugins/litcodex/components/start-work-continuation/dist/codex-hook.js +65 -0
- package/marketplace/plugins/litcodex/components/start-work-continuation/package.json +1 -1
- package/marketplace/plugins/litcodex/components/telemetry/package.json +1 -1
- package/marketplace/plugins/litcodex/components/wikify-knowledge/package.json +1 -1
- package/marketplace/plugins/litcodex/hooks/hooks.json +24 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/SKILL.md +6 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/components.css +414 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/fonts.json +22 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/layouts/landing.html +164 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/layouts/settings.html +114 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/layouts/workspace.html +115 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/computational-brutalism.json +227 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/field-notes.json +205 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/graphite.json +200 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/meadow.json +199 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/neo-brutalism.json +222 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/ui.js +228 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/brand-and-imagery.md +1 -1
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/complete-contract.md +1 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/craft-floor.md +2 -2
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/default-editorial-pixel.json +15 -8
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/design-choice.md +19 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/house-styles.md +235 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/motion-guide.md +2 -2
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/probe-and-review.md +6 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/production-interview.md +2 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/slop-register.md +4 -4
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/design-lock.mjs +400 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/lock-probe.mjs +196 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/page-probe.mjs +22 -4
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/pixel-art.mjs +60 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/probe.mjs +59 -13
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/rule-data.mjs +38 -4
- package/marketplace/plugins/litcodex/skills/lit-adhd/SKILL.md +185 -0
- package/marketplace/plugins/litcodex/skills/lit-adhd/agents/openai.yaml +6 -0
- package/marketplace/plugins/litcodex/skills/lit-adhd/references/card-examples.md +163 -0
- package/marketplace/plugins/litcodex/skills/lit-adhd/references/status-taxonomy.md +45 -0
- package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/SKILL.md +18 -7
- package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/style-guide.md +20 -11
- package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-architecture.md +3 -3
- package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-dependency.md +1 -1
- package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-swimlane.md +1 -1
- package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-tree-block-decomposition.md +1 -1
- package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-tree.md +3 -3
- package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-wardley.md +1 -1
- package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/verifier-guide.md +1 -0
- package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/diagram-craft-rules.mjs +1 -2
- package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/visual-quality.mjs +1 -2
- package/marketplace/plugins/litcodex/skills/lit-docx/SKILL.md +12 -3
- package/marketplace/plugins/litcodex/skills/lit-docx/references/direction-step.md +6 -3
- package/marketplace/plugins/litcodex/skills/lit-hijack/SKILL.md +449 -0
- package/marketplace/plugins/litcodex/skills/lit-hijack/agents/openai.yaml +6 -0
- package/marketplace/plugins/litcodex/skills/lit-hijack/references/capture-and-provenance.md +100 -0
- package/marketplace/plugins/litcodex/skills/lit-hijack/references/clean-room-build.md +111 -0
- package/marketplace/plugins/litcodex/skills/lit-hijack/references/distil-and-licence.md +102 -0
- package/marketplace/plugins/litcodex/skills/lit-hijack/references/gap-and-port-design.md +125 -0
- package/marketplace/plugins/litcodex/skills/lit-hijack/references/parity-and-report.md +108 -0
- package/marketplace/plugins/litcodex/skills/lit-hijack/scripts/hijack.mjs +1050 -0
- package/marketplace/plugins/litcodex/skills/lit-loop/SKILL.md +13 -4
- package/marketplace/plugins/litcodex/skills/lit-plan/SKILL.md +9 -2
- package/marketplace/plugins/litcodex/skills/lit-plan/references/full-workflow.md +2 -1
- package/marketplace/plugins/litcodex/skills/lit-pptx/NOTICE +1 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/SKILL.md +35 -8
- package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/jetbrains-mono/JetBrainsMono-Bold.ttf +0 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/jetbrains-mono/JetBrainsMono-Regular.ttf +0 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/jetbrains-mono/OFL.txt +93 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/jetbrains-mono/SOURCE.md +21 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/anti-slop-checklist.md +5 -2
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/authoring-guide.md +3 -4
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/density-and-fill.md +20 -6
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/direction-step.md +26 -8
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/14-engineering-review-computational-brutalism-ko.md +173 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/15-launch-pitch-neo-brutalism-ko.md +154 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/16-design-lecture-bauhaus-ko.md +139 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/17-community-programme-riso-ko.md +158 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/18-public-data-briefing-newsroom-ko.md +179 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/layout-families.md +42 -27
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/title-treatments.md +31 -27
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/bauhaus.md +136 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/chalk.md +1 -1
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/computational-brutalism.md +145 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/neo-brutalism.md +155 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/newsroom.md +141 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/riso.md +133 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/signal.md +1 -1
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/studio.md +1 -1
- package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/compile-deck.js +1 -1
- package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/craft_extras.py +136 -94
- package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/embed_fonts.py +13 -1
- package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/grid-resolver.js +101 -110
- package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/layout-resolver.js +9 -15
- package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/render-pack.js +386 -579
- package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/slide-grid.js +104 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/template-registry.js +57 -6
- package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/office-run.mjs +2 -1
- package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/qa_deck.py +7 -13
- package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/render_pages.py +124 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/atlas/pack.yaml +1 -1
- package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/bauhaus/pack.yaml +98 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/chalk/pack.yaml +1 -1
- package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/computational-brutalism/pack.yaml +100 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/gazette/pack.yaml +1 -1
- package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/ledger/pack.yaml +1 -1
- package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/neo-brutalism/pack.yaml +107 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/newsroom/pack.yaml +99 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/night/pack.yaml +1 -1
- package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/paper/pack.yaml +1 -1
- package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/riso/pack.yaml +99 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/signal/pack.yaml +2 -2
- package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/studio/pack.yaml +1 -1
- package/marketplace/plugins/litcodex/skills/lit-recap/SKILL.md +2 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/SKILL.md +198 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/agents/openai.yaml +6 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/examples/iso-heat-exchanger/build.mjs +38 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/examples/iso-heat-exchanger/scene.mjs +133 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/examples/journal-adsorption-rig/build.mjs +87 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/examples/pid-dosing-skid/build.mjs +85 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/references/cutaway-outputs.md +70 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/references/isometric-craft.md +101 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/references/journal-figures.md +72 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/references/kit-api.md +134 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/references/pfd-and-layout.md +53 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/references/pid-drafting.md +103 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/references/pid-symbols.md +163 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/references/verification.md +100 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/doctor.mjs +57 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/figure.mjs +81 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/fonts.mjs +28 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/geom.mjs +113 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/interactive.mjs +292 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/isa.mjs +115 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/iso.mjs +719 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/legend-sheet.mjs +162 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/pid.mjs +937 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/png.mjs +132 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/qa-core.mjs +658 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/route.mjs +218 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/sheet.mjs +890 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/svg.mjs +82 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/theme.mjs +115 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/motion.mjs +129 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/qa.mjs +92 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/render.mjs +233 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/scaffold.mjs +60 -0
- package/marketplace/plugins/litcodex/skills/lit-scientific-visualization/SKILL.md +34 -8
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/SKILL.md +18 -14
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/THIRD_PARTY_NOTICES +12 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/assets.mjs +388 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/blender/runner.py +221 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/blender.mjs +132 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/board.mjs +142 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/constants.mjs +6 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-assets.mjs +7 -4
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-capture.mjs +8 -7
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-init.js +14 -2
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-treatment.mjs +38 -3
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover.mjs +19 -4
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/driver.mjs +8 -8
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/gallery.mjs +147 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/house.mjs +45 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/image.mjs +89 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/look.mjs +58 -25
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/runtime.mjs +59 -14
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/safe-read.mjs +32 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/scaffold.mjs +208 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/score.mjs +668 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/sound.mjs +174 -31
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-gate.mjs +45 -3
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-kit.js +99 -1
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-qa.js +8 -1
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-qa.mjs +180 -11
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-render.mjs +42 -12
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-worker.mjs +7 -4
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage.mjs +96 -10
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/styles.mjs +233 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/treatment.mjs +291 -14
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/vendor/three/LICENSE +21 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/vendor/three/addons/environments/RoomEnvironment.js +144 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/vendor/three/addons/geometries/RoundedBoxGeometry.js +155 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/vendor/three/three.module.js +54571 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/hero-3d/expected.json +33 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/hero-3d/index.html +139 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/cover.md +44 -7
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/depth.md +156 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/design-choice.md +22 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/quality-gate.md +29 -7
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/runtime.md +1 -1
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/sound.md +87 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/stage.md +19 -7
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/studio.md +246 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/style-bibles.md +2 -2
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/treatment.md +41 -21
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/scripts/render.mjs +51 -4
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/styles/paper.json +185 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/styles/swiss-signal.json +188 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/styles/terminalcore.json +182 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/styles/tidal.json +187 -0
- package/marketplace/plugins/litcodex/skills/litresearch/SKILL.md +7 -0
- package/marketplace/plugins/litcodex/skills/litwork/SKILL.md +2 -1
- package/marketplace/plugins/litcodex/skills/readme-studio/SKILL.md +10 -0
- package/marketplace/plugins/litcodex/skills/review-work/SKILL.md +7 -1
- package/marketplace/plugins/litcodex/skills/start-work/SKILL.md +11 -1
- package/node_modules/@litcodex/lit-loop/directive.md +10 -4
- package/node_modules/@litcodex/lit-loop/directives/lit-adhd.md +194 -0
- package/node_modules/@litcodex/lit-loop/directives/lit-handoff.md +2 -0
- package/node_modules/@litcodex/lit-loop/directives/lit-hijack.md +219 -0
- package/node_modules/@litcodex/lit-loop/directives/lit-plan.md +2 -1
- package/node_modules/@litcodex/lit-loop/directives/lit-recap.md +2 -0
- package/node_modules/@litcodex/lit-loop/directives/lit-schematic.md +199 -0
- package/node_modules/@litcodex/lit-loop/directives/litwork.md +2 -1
- package/node_modules/@litcodex/lit-loop/dist/adhd-suggest.d.ts +10 -0
- package/node_modules/@litcodex/lit-loop/dist/adhd-suggest.js +67 -0
- package/node_modules/@litcodex/lit-loop/dist/card-html.d.ts +1 -1
- package/node_modules/@litcodex/lit-loop/dist/card-html.js +128 -8
- package/node_modules/@litcodex/lit-loop/dist/card-looks.d.ts +19 -0
- package/node_modules/@litcodex/lit-loop/dist/card-looks.js +58 -0
- package/node_modules/@litcodex/lit-loop/dist/card-status.d.ts +30 -0
- package/node_modules/@litcodex/lit-loop/dist/card-status.js +97 -7
- package/node_modules/@litcodex/lit-loop/dist/cli.js +13 -3
- package/node_modules/@litcodex/lit-loop/dist/codex-hook.d.ts +2 -0
- package/node_modules/@litcodex/lit-loop/dist/codex-hook.js +8 -9
- package/node_modules/@litcodex/lit-loop/dist/control-chars.d.ts +5 -0
- package/node_modules/@litcodex/lit-loop/dist/control-chars.js +23 -0
- package/node_modules/@litcodex/lit-loop/dist/hook-cli.d.ts +8 -0
- package/node_modules/@litcodex/lit-loop/dist/hook-cli.js +126 -13
- package/node_modules/@litcodex/lit-loop/dist/hud.d.ts +1 -1
- package/node_modules/@litcodex/lit-loop/dist/hud.js +29 -13
- package/node_modules/@litcodex/lit-loop/dist/lane-events.d.ts +13 -0
- package/node_modules/@litcodex/lit-loop/dist/lane-events.js +85 -0
- package/node_modules/@litcodex/lit-loop/dist/lane-state.d.ts +55 -0
- package/node_modules/@litcodex/lit-loop/dist/lane-state.js +227 -0
- package/node_modules/@litcodex/lit-loop/dist/live-step.d.ts +5 -1
- package/node_modules/@litcodex/lit-loop/dist/live-step.js +17 -1
- package/node_modules/@litcodex/lit-loop/dist/markers.d.ts +6 -0
- package/node_modules/@litcodex/lit-loop/dist/markers.js +6 -0
- package/node_modules/@litcodex/lit-loop/dist/modes.d.ts +1 -1
- package/node_modules/@litcodex/lit-loop/dist/modes.js +25 -1
- package/node_modules/@litcodex/lit-loop/dist/motion-gate.d.ts +79 -0
- package/node_modules/@litcodex/lit-loop/dist/motion-gate.js +310 -0
- package/node_modules/@litcodex/lit-loop/dist/motion-route.js +5 -1
- package/node_modules/@litcodex/lit-loop/dist/plan-persistence.d.ts +1 -1
- package/node_modules/@litcodex/lit-loop/dist/plan-persistence.js +38 -2
- package/node_modules/@litcodex/lit-loop/dist/plan-scope-roots.d.ts +7 -0
- package/node_modules/@litcodex/lit-loop/dist/plan-scope-roots.js +76 -0
- package/node_modules/@litcodex/lit-loop/dist/redaction.js +18 -0
- package/node_modules/@litcodex/lit-loop/dist/reentry.d.ts +15 -0
- package/node_modules/@litcodex/lit-loop/dist/reentry.js +46 -9
- package/node_modules/@litcodex/lit-loop/dist/restart-chip.d.ts +6 -0
- package/node_modules/@litcodex/lit-loop/dist/restart-chip.js +59 -0
- package/node_modules/@litcodex/lit-loop/dist/rewind-cli.d.ts +10 -0
- package/node_modules/@litcodex/lit-loop/dist/rewind-cli.js +88 -0
- package/node_modules/@litcodex/lit-loop/dist/rewind-go.d.ts +20 -0
- package/node_modules/@litcodex/lit-loop/dist/rewind-go.js +94 -0
- package/node_modules/@litcodex/lit-loop/dist/rewind-look.d.ts +6 -0
- package/node_modules/@litcodex/lit-loop/dist/rewind-look.js +41 -0
- package/node_modules/@litcodex/lit-loop/dist/rewind-redact.d.ts +3 -0
- package/node_modules/@litcodex/lit-loop/dist/rewind-redact.js +40 -0
- package/node_modules/@litcodex/lit-loop/dist/rewind-rollout.d.ts +48 -0
- package/node_modules/@litcodex/lit-loop/dist/rewind-rollout.js +292 -0
- package/node_modules/@litcodex/lit-loop/dist/rewind.d.ts +168 -0
- package/node_modules/@litcodex/lit-loop/dist/rewind.js +867 -0
- package/node_modules/@litcodex/lit-loop/dist/route-heads.js +45 -3
- package/node_modules/@litcodex/lit-loop/dist/run-panel.js +1 -0
- package/node_modules/@litcodex/lit-loop/dist/schematic-route.d.ts +6 -0
- package/node_modules/@litcodex/lit-loop/dist/schematic-route.js +35 -0
- package/node_modules/@litcodex/lit-loop/dist/screen-card.d.ts +3 -0
- package/node_modules/@litcodex/lit-loop/dist/screen-card.js +15 -5
- package/node_modules/@litcodex/lit-loop/dist/session-liveness.d.ts +16 -0
- package/node_modules/@litcodex/lit-loop/dist/session-liveness.js +90 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-mention-scope.js +6 -0
- package/node_modules/@litcodex/lit-loop/dist/stack-hook.d.ts +8 -0
- package/node_modules/@litcodex/lit-loop/dist/stack-hook.js +57 -0
- package/node_modules/@litcodex/lit-loop/dist/statusline.js +8 -3
- package/node_modules/@litcodex/lit-loop/dist/threads.d.ts +50 -0
- package/node_modules/@litcodex/lit-loop/dist/threads.js +183 -0
- package/node_modules/@litcodex/lit-loop/dist/trigger.d.ts +1 -1
- package/node_modules/@litcodex/lit-loop/dist/trigger.js +29 -5
- package/node_modules/@litcodex/lit-loop/dist/workflow-map.d.ts +10 -0
- package/node_modules/@litcodex/lit-loop/dist/workflow-map.js +11 -1
- package/node_modules/@litcodex/lit-loop/dist/workflow-stack.d.ts +139 -0
- package/node_modules/@litcodex/lit-loop/dist/workflow-stack.js +518 -0
- package/node_modules/@litcodex/lit-loop/package.json +1 -1
- package/node_modules/@litcodex/lit-loop/skills/lit-adhd/SKILL.md +185 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-hijack/SKILL.md +449 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-loop/SKILL.md +13 -4
- package/node_modules/@litcodex/lit-loop/skills/lit-plan/SKILL.md +9 -2
- package/node_modules/@litcodex/lit-loop/skills/lit-recap/SKILL.md +2 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-schematic/SKILL.md +198 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-scientific-visualization/SKILL.md +34 -8
- package/node_modules/@litcodex/lit-loop/skills/litresearch/SKILL.md +7 -0
- package/node_modules/@litcodex/lit-loop/skills/litwork/SKILL.md +2 -1
- package/node_modules/@litcodex/lit-loop/skills/review-work/SKILL.md +7 -1
- package/node_modules/@litcodex/lit-loop/skills/start-work/SKILL.md +11 -1
- package/package.json +3 -2
- package/readme-assets/badge-version.svg +1 -1
- package/readme-assets/skills/lit-adhd.webp +0 -0
- package/readme-assets/skills/lit-hijack.webp +0 -0
- package/readme-assets/skills/lit-schematic.webp +0 -0
package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-treatment.mjs
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
// The cover treatment: `treatment.json` with `"mode": "cover"`, written before the first cover render
|
|
2
2
|
// and validated by every one (exit 16 names the first bad field). A cover is not a film: no beats, no
|
|
3
|
-
// arc, no ending, no copy lines, no sound. It names one recipe
|
|
3
|
+
// arc, no ending, no copy lines, no sound. It names one recipe (the hero that acts and the one beat it
|
|
4
|
+
// acts once per loop for the 3D hero), one rule and its copies, the three speed
|
|
4
5
|
// layers, the brand word set once (plus at most one motto the user or the project already uses), the
|
|
5
6
|
// aspect and loop length, and the title box the contrast and cap-height gates measure. Every string in
|
|
6
7
|
// it is the user's content or the director's plan, never an instruction.
|
|
7
8
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
8
9
|
import { join } from "node:path";
|
|
9
|
-
import {
|
|
10
|
+
import { normUrl, requestUrls } from "./assets.mjs";
|
|
11
|
+
import { COVER, EXIT, Exit } from "./constants.mjs";
|
|
10
12
|
import { findPlaceholder, normalizeText, sharesRun, stripQuoted, TreatmentError } from "./treatment.mjs";
|
|
11
13
|
|
|
12
|
-
export const RECIPES = Object.freeze(["painted-light", "weight-tide", "orbit-loop", "own"]);
|
|
14
|
+
export const RECIPES = Object.freeze(["hero-3d", "painted-light", "weight-tide", "orbit-loop", "own"]);
|
|
13
15
|
export const LAYERS = Object.freeze(["slow", "mid", "beat"]);
|
|
14
16
|
|
|
15
17
|
const fault = (field, message) => {
|
|
@@ -28,6 +30,20 @@ function text(t, path, { maxSentences } = {}) {
|
|
|
28
30
|
return value;
|
|
29
31
|
}
|
|
30
32
|
|
|
33
|
+
// A link in the request names the product: the cover is built from its real logo, images and words,
|
|
34
|
+
// fetched by `render.mjs assets --cover` before the treatment, never from the name alone.
|
|
35
|
+
function checkCoverProduct(t) {
|
|
36
|
+
const urls = requestUrls(t.request);
|
|
37
|
+
if (!("product" in t)) {
|
|
38
|
+
if (urls.length) fault("product", `missing: the request links ${urls[0]}; fetch its real assets first with render.mjs assets --out <dir> --url <link> --cover, look at them, and set product { name, url } (references/cover.md, Named products)`);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (!t.product || typeof t.product !== "object") fault("product", "must be an object { name, url }");
|
|
42
|
+
text(t, "product.name");
|
|
43
|
+
if (urls.length && !urls.includes(normUrl(t.product.url))) fault("product.url", `must be the link the request gives (${urls.join(", ")})`);
|
|
44
|
+
if ("unreachable" in t.product) text(t, "product.unreachable");
|
|
45
|
+
}
|
|
46
|
+
|
|
31
47
|
/** Validate a cover treatment. Returns it with the page and cover sizes, frame count, encode and seed filled in. */
|
|
32
48
|
export function validateCoverTreatment(t) {
|
|
33
49
|
if (!t || typeof t !== "object" || Array.isArray(t)) fault("treatment", "must be a JSON object");
|
|
@@ -41,6 +57,11 @@ export function validateCoverTreatment(t) {
|
|
|
41
57
|
if (sharesRun(idea, stripQuoted(request), limit)) fault("idea", `restates the request (shares ${limit}+ normalized characters with it); say what the loop does`);
|
|
42
58
|
if (!RECIPES.includes(t.recipe)) fault("recipe", t.recipe === undefined ? "missing" : `must be one of ${RECIPES.join(", ")}`);
|
|
43
59
|
text(t, "recipeReason", { maxSentences: 2 });
|
|
60
|
+
// The 3D hero is one object doing one thing once per loop: both are named. Other recipes may name them too.
|
|
61
|
+
for (const key of ["hero", "beat"]) {
|
|
62
|
+
if (t.recipe === "hero-3d" || key in t) text(t, key, { maxSentences: 2 });
|
|
63
|
+
}
|
|
64
|
+
checkCoverProduct(t);
|
|
44
65
|
const brand = text(t, "brandWord");
|
|
45
66
|
if (words(brand) > 3) fault("brandWord", "is the name set once: at most three words");
|
|
46
67
|
if ("motto" in t) {
|
|
@@ -93,6 +114,20 @@ export function loadCoverTreatment(outDir) {
|
|
|
93
114
|
}
|
|
94
115
|
if (raw?.mode !== "cover") fault("mode", "this treatment is a film: render it with stage or film (references/treatment.md); a cover sets \"mode\": \"cover\"");
|
|
95
116
|
const treatment = validateCoverTreatment(raw);
|
|
117
|
+
const product = treatment.product;
|
|
118
|
+
if (product?.unreachable) throw new Exit(EXIT.BLOCKED_ASSET_MISSING, `BLOCKED_ASSET_MISSING: ${product.name}'s real assets could not be reached (${product.unreachable}); ask the user for its logo or README images, put them in ${join(outDir, "cover", "assets")} and list them in assets.json`);
|
|
119
|
+
if (product) {
|
|
120
|
+
const record = join(outDir, "product.json");
|
|
121
|
+
if (!existsSync(record)) fault("product", `no ${record}: run render.mjs assets --out ${outDir} --url ${product.url} --cover first`);
|
|
122
|
+
let fetched = [];
|
|
123
|
+
try {
|
|
124
|
+
fetched = JSON.parse(readFileSync(record, "utf8"))?.product?.assets ?? [];
|
|
125
|
+
} catch (error) {
|
|
126
|
+
fault("product", `${record} is not valid JSON (${error.message}); run render.mjs assets --out ${outDir} --url ${product.url} --cover again`);
|
|
127
|
+
}
|
|
128
|
+
const astray = fetched.filter((a) => !String(a?.path ?? "").startsWith("cover/assets/"));
|
|
129
|
+
if (astray.length) fault("product", `${astray[0].path} sits outside cover/assets/, where the cover page cannot load it; run render.mjs assets --out ${outDir} --url ${product.url} --cover again`);
|
|
130
|
+
}
|
|
96
131
|
const first = join(outDir, ".run", "treatment-first.json");
|
|
97
132
|
if (!existsSync(first)) {
|
|
98
133
|
mkdirSync(join(outDir, ".run"), { recursive: true });
|
|
@@ -22,7 +22,7 @@ import { loadCoverTreatment } from "./cover-treatment.mjs";
|
|
|
22
22
|
import { countFlashes, detectLoopingStream } from "./flash.mjs";
|
|
23
23
|
import { FONTS, verifyFonts } from "./fonts.mjs";
|
|
24
24
|
import { encodePng } from "./image.mjs";
|
|
25
|
-
import { resolveRuntime, which } from "./runtime.mjs";
|
|
25
|
+
import { firstLine, resolveRuntime, which } from "./runtime.mjs";
|
|
26
26
|
import { fontRoutes, scanStage, stageFontFaults } from "./stage.mjs";
|
|
27
27
|
import { TreatmentError } from "./treatment.mjs";
|
|
28
28
|
import { findDwebp, findImg2webp } from "./webp.mjs";
|
|
@@ -175,9 +175,22 @@ export async function renderCover({ outDir, round, log = () => {}, env = process
|
|
|
175
175
|
let master;
|
|
176
176
|
let replay;
|
|
177
177
|
let sought;
|
|
178
|
+
// The 3D hero asks for the GPU rung. When it cannot start or draw there, all three passes take the
|
|
179
|
+
// software rung (they must share one) and the report says so.
|
|
180
|
+
let rung = treatment.recipe === "hero-3d" ? "gpu" : "software";
|
|
181
|
+
const notices = [];
|
|
178
182
|
try {
|
|
179
183
|
const pass = async (label, work) => {
|
|
180
|
-
const
|
|
184
|
+
const open = () => CoverSession.open({ runtime, scan, fonts, width: pw, height: ph, scale: COVER.captureScale, profileDir: join(runDir, `chrome-${label}`), rung, env });
|
|
185
|
+
let session;
|
|
186
|
+
try {
|
|
187
|
+
session = await open();
|
|
188
|
+
} catch (error) {
|
|
189
|
+
if (rung !== "gpu" || error instanceof Exit) throw error;
|
|
190
|
+
notices.push(`the 3D hero asked for the GPU rung and it did not start (${firstLine(String(error.message)).slice(0, 120)}); rendered on the software rung (SwiftShader), slower, same frames`);
|
|
191
|
+
rung = "software";
|
|
192
|
+
session = await open();
|
|
193
|
+
}
|
|
181
194
|
try {
|
|
182
195
|
return await work(session);
|
|
183
196
|
} finally {
|
|
@@ -257,7 +270,7 @@ export async function renderCover({ outDir, round, log = () => {}, env = process
|
|
|
257
270
|
const stillsManifest = `${JSON.stringify({ schema: 1, kind: "cover", mode: "cover", round, width: gate.width, height: gate.height, fps: treatment.fps, durationSec: gate.sourceDurationSec, files: stills.files }, null, 2)}\n`;
|
|
258
271
|
writeFileSync(join(stills.dir, "manifest.json"), stillsManifest);
|
|
259
272
|
writeFileSync(join(outDir, "poster.png"), readFileSync(join(stills.dir, "poster.png")));
|
|
260
|
-
const report = formatCoverReport(gate, { strict: true })
|
|
273
|
+
const report = `${formatCoverReport(gate, { strict: true })}${notices.map((n) => `warning: ${n}\n`).join("")}`;
|
|
261
274
|
writeFileSync(join(outDir, "gate-report.txt"), report);
|
|
262
275
|
const manifest = {
|
|
263
276
|
schemaVersion: 1,
|
|
@@ -265,6 +278,8 @@ export async function renderCover({ outDir, round, log = () => {}, env = process
|
|
|
265
278
|
mode: "cover",
|
|
266
279
|
round,
|
|
267
280
|
recipe: treatment.recipe,
|
|
281
|
+
rung,
|
|
282
|
+
warnings: notices,
|
|
268
283
|
treatmentSha256: sha256(readFileSync(join(outDir, "treatment.json"))),
|
|
269
284
|
stillsManifestSha256: sha256(stillsManifest),
|
|
270
285
|
page: treatment.page,
|
|
@@ -319,7 +334,7 @@ export async function renderCoverWindow({ outDir, round, window: [t0, t1], log =
|
|
|
319
334
|
mkdirSync(dir, { recursive: true });
|
|
320
335
|
const size = treatment.size;
|
|
321
336
|
const pool = new CoverPool();
|
|
322
|
-
const session = await CoverSession.open({ runtime, scan, fonts, width: treatment.page[0], height: treatment.page[1], scale: COVER.captureScale, profileDir: join(outDir, ".run", "cover-window-chrome"), env });
|
|
337
|
+
const session = await CoverSession.open({ runtime, scan, fonts, width: treatment.page[0], height: treatment.page[1], scale: COVER.captureScale, profileDir: join(outDir, ".run", "cover-window-chrome"), rung: treatment.recipe === "hero-3d" ? "gpu" : "software", env });
|
|
323
338
|
try {
|
|
324
339
|
await capturePass({ session, pool, times: [...new Set(picks.map((p) => p.index))].map((i) => [i, i / treatment.frames]), dir, size });
|
|
325
340
|
} finally {
|
|
@@ -69,18 +69,18 @@ export async function launch({ runtime, outDir, scale, env = process.env, log =
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
|
-
* Launch the stage path's Chrome:
|
|
73
|
-
* .run/ folder, service workers blocked, and a viewport exactly
|
|
74
|
-
* installs routes before the first navigation.
|
|
72
|
+
* Launch the stage path's Chrome: the round's rung (software by default, "gpu" for a 3D film) with the
|
|
73
|
+
* stage flags, a profile under the run's .run/ folder, service workers blocked, and a viewport exactly
|
|
74
|
+
* the film's frame. The caller installs routes before the first navigation.
|
|
75
75
|
*/
|
|
76
|
-
export async function launchStage({ runtime, outDir, width, height, env = process.env }) {
|
|
76
|
+
export async function launchStage({ runtime, outDir, width, height, rung = "software", env = process.env }) {
|
|
77
77
|
const chrome = findChrome(env);
|
|
78
78
|
if (!chrome) throw new Blocked(EXIT.BLOCKED_NO_CHROME, "BLOCKED_NO_CHROME", "Chrome/Chromium not found: install Google Chrome or set CHROME_PATH");
|
|
79
79
|
const { chromium } = await import(pathToFileURL(runtime.playwright).href);
|
|
80
80
|
const runDir = join(outDir, ".run");
|
|
81
81
|
mkdirSync(runDir, { recursive: true });
|
|
82
82
|
const profileRoot = mkdtempSync(join(runDir, "s"));
|
|
83
|
-
const flags = stageFlags(width, height);
|
|
83
|
+
const flags = stageFlags(width, height, process.platform, rung);
|
|
84
84
|
let context;
|
|
85
85
|
try {
|
|
86
86
|
context = await chromium.launchPersistentContext(join(profileRoot, "p"), {
|
|
@@ -97,7 +97,7 @@ export async function launchStage({ runtime, outDir, width, height, env = proces
|
|
|
97
97
|
throw new Blocked(EXIT.BLOCKED_NO_CHROME, "BLOCKED_NO_CHROME", `Chrome failed to launch headless: ${firstLine(error.message.replace(/^browserType\.launchPersistentContext:\s*/u, ""))}`);
|
|
98
98
|
}
|
|
99
99
|
const page = context.pages()[0] ?? (await context.newPage());
|
|
100
|
-
return { context, page, chrome, flags, profileRoot };
|
|
100
|
+
return { context, page, chrome, flags, rung, profileRoot };
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
/**
|
|
@@ -105,12 +105,12 @@ export async function launchStage({ runtime, outDir, width, height, env = proces
|
|
|
105
105
|
* viewport the cover page's CSS size, a profile at `profileDir`, service workers blocked. The caller
|
|
106
106
|
* installs routes before the first navigation and removes the profile after closing.
|
|
107
107
|
*/
|
|
108
|
-
export async function launchCover({ runtime, width, height, scale, profileDir, env = process.env }) {
|
|
108
|
+
export async function launchCover({ runtime, width, height, scale, profileDir, rung = "software", env = process.env }) {
|
|
109
109
|
const chrome = findChrome(env);
|
|
110
110
|
if (!chrome) throw new Blocked(EXIT.BLOCKED_NO_CHROME, "BLOCKED_NO_CHROME", "Chrome/Chromium not found: install Google Chrome or set CHROME_PATH");
|
|
111
111
|
const { chromium } = await import(pathToFileURL(runtime.playwright).href);
|
|
112
112
|
try {
|
|
113
|
-
const context = await chromium.launchPersistentContext(profileDir, { executablePath: chrome, headless: true, args: coverFlags(width, height, scale), viewport: { width, height }, deviceScaleFactor: scale, serviceWorkers: "block", timeout: 45000 });
|
|
113
|
+
const context = await chromium.launchPersistentContext(profileDir, { executablePath: chrome, headless: true, args: coverFlags(width, height, scale, process.platform, rung), viewport: { width, height }, deviceScaleFactor: scale, serviceWorkers: "block", timeout: 45000 });
|
|
114
114
|
return { context, page: context.pages()[0] ?? (await context.newPage()) };
|
|
115
115
|
} catch (error) {
|
|
116
116
|
rmSync(profileDir, { recursive: true, force: true });
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
// `render.mjs styles --out <dir> [--format 16:9|9:16]`: the style gallery. One short demo film, the
|
|
2
|
+
// same treatment and the same drawings, rendered as a board round in every house style, so a person
|
|
3
|
+
// can see what each style looks like before asking for a film. Each style's board lands in
|
|
4
|
+
// `<dir>/<style>/stills/board.png`, and `<dir>/styles.png` puts them side by side. The demo also
|
|
5
|
+
// proves the styles and the scaffold pass the board check as shipped.
|
|
6
|
+
import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
7
|
+
import { join } from "node:path";
|
|
8
|
+
import { EXIT, Exit } from "./constants.mjs";
|
|
9
|
+
import { contactSheet, decodePng, downscale, encodePng } from "./image.mjs";
|
|
10
|
+
import { scaffoldHtml } from "./scaffold.mjs";
|
|
11
|
+
import { runStage } from "./stage-render.mjs";
|
|
12
|
+
import { readStyle, STYLE_IDS } from "./styles.mjs";
|
|
13
|
+
import { loadTreatment } from "./treatment.mjs";
|
|
14
|
+
|
|
15
|
+
const COPY = ["작게 시작해서 끝까지", "One clock for every frame", "한 화면에 한 가지 생각", "Same house, every film"];
|
|
16
|
+
|
|
17
|
+
/** The demo treatment for one style: four shots, one of each text layout, 12 s. */
|
|
18
|
+
export function demoTreatment(styleId, format = "16:9") {
|
|
19
|
+
const style = readStyle(styleId);
|
|
20
|
+
const hand = (i) => style.transitions[i % style.transitions.length];
|
|
21
|
+
const vertical = format === "9:16" ? " vertical" : "";
|
|
22
|
+
const beats = [
|
|
23
|
+
{ t0: 0, t1: 3, layout: "title", hero: "The opening line lands while a ring draws itself behind it.", purpose: "Open on the promise.", onScreen: "A ring drawing on behind the opening line.", motion: "The ring draws on; the line rises in.", sound: "Pad opens with a hit on the first word." },
|
|
24
|
+
{ t0: 3, t1: 6, layout: "split", hero: "Five bars rise in turn beside the line.", purpose: "Show the system.", onScreen: "Five bars rising beside one line.", motion: "Bars rise in stagger.", sound: "Hit on the cut." },
|
|
25
|
+
{ t0: 6, t1: 9, layout: "split-alt", hero: "A dot travels a path from left to right.", purpose: "Show one idea per screen.", onScreen: "A dot crossing a drawn path.", motion: "The dot travels the path.", sound: "A rise into the close." },
|
|
26
|
+
{ t0: 9, t1: 12, layout: "stage", hero: "A grid of squares settles above the closing line.", purpose: "Close on the house.", onScreen: "A settling grid of squares over a closing caption.", motion: "Squares settle in stagger.", sound: "Closing cadence." },
|
|
27
|
+
].map((b, i, all) => ({ ...b, lines: [i], transition: i === all.length - 1 ? "end" : hand(i) }));
|
|
28
|
+
const p = style.palette;
|
|
29
|
+
return {
|
|
30
|
+
// A calibration sheet, not a film: the same simple demo in every style, so the styles compare.
|
|
31
|
+
request: `render a 12 s${vertical} simple demo film in the ${styleId === "paper" ? "paper style" : `${styleId} style`}`,
|
|
32
|
+
register: "minimal",
|
|
33
|
+
genre: "other",
|
|
34
|
+
path: "stage",
|
|
35
|
+
pathReason: "The demo draws shapes beside its type, which the type engine cannot draw.",
|
|
36
|
+
style: styleId,
|
|
37
|
+
idea: "Four screens, one per layout, so the house style can be judged before a film is made.",
|
|
38
|
+
audience: "Someone choosing a house style for their films.",
|
|
39
|
+
channel: "A gallery sheet viewed before a film is made, played with sound.",
|
|
40
|
+
format,
|
|
41
|
+
formatReason: format === "9:16" ? "The gallery shows the vertical layouts." : "The gallery shows the landscape layouts.",
|
|
42
|
+
durationSec: 12,
|
|
43
|
+
beats,
|
|
44
|
+
story: { expect: "Four screens that each show a new shape.", turn: "The bars of the second screen become the path the dot travels on the third.", beat: 2, payoff: "Everything settles into one grid above the closing line." },
|
|
45
|
+
protagonist: {
|
|
46
|
+
name: "the signal mark",
|
|
47
|
+
kind: "object",
|
|
48
|
+
look: "The style's signal colour as a ring, bars, a dot and one accent square.",
|
|
49
|
+
acts: [
|
|
50
|
+
{ beat: 0, action: "Draws itself as a ring." },
|
|
51
|
+
{ beat: 1, action: "Rises as five bars." },
|
|
52
|
+
{ beat: 2, action: "Travels the path as a dot." },
|
|
53
|
+
{ beat: 3, action: "Lands as the accent square of the grid." },
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
subject: { name: "the style demo", source: "invented", specifics: ["Four screens with a ring, bars, a travelling dot and a grid.", "Each screen uses one layout of the house grid."] },
|
|
57
|
+
visualDevices: [
|
|
58
|
+
{ kind: "shape", role: "subject", beats: [0, 1, 2, 3] },
|
|
59
|
+
{ kind: "path", role: "support", beats: [2] },
|
|
60
|
+
],
|
|
61
|
+
typePlan: { faces: [style.faces.headline.family], hierarchy: "One line per screen in the style's headline or display size.", maxWordsOnScreen: 6 },
|
|
62
|
+
palette: [
|
|
63
|
+
{ hex: p.ground, role: "ground" },
|
|
64
|
+
{ hex: p.ink, role: "type" },
|
|
65
|
+
{ hex: p.signal, role: "signal" },
|
|
66
|
+
],
|
|
67
|
+
sound: {
|
|
68
|
+
mode: "generated",
|
|
69
|
+
plan: "The style's own bed with a hit on the cuts and a closing cadence.",
|
|
70
|
+
...style.sound,
|
|
71
|
+
events: [
|
|
72
|
+
{ t: 1.2, on: "The ring closes.", kind: "tap" },
|
|
73
|
+
{ t: 4.4, on: "The last bar reaches its height.", kind: "tap" },
|
|
74
|
+
{ t: 10.6, on: "The accent square lands in the grid.", kind: "chime" },
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
copy: { source: "invented", lines: COPY },
|
|
78
|
+
inventions: ["the style demo (its four screens)", "all four copy lines"],
|
|
79
|
+
ambition: "Each screen shows one layout cleanly so the style's type, colour and motion read at a glance.",
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// The demo's drawings: generic shapes in the style's own colours, one per shot.
|
|
84
|
+
const DEMO_DRAW = [
|
|
85
|
+
`(s, svg) => {
|
|
86
|
+
const z = LitStage.zone(s.layout, "subject");
|
|
87
|
+
const r = Math.min(z.w, z.h) * 0.34;
|
|
88
|
+
const len = 2 * Math.PI * r;
|
|
89
|
+
svg.innerHTML = \`<circle cx="\${z.w * 0.5}" cy="\${z.h * 0.5}" r="\${r}" fill="none" stroke="var(--lit-line)" stroke-width="6"/><circle cx="\${z.w * 0.5}" cy="\${z.h * 0.5}" r="\${r}" fill="none" stroke="var(--lit-signal)" stroke-width="6" stroke-dasharray="\${len}" stroke-dashoffset="\${len * (1 - s.enter(0, 1.6))}"/>\`;
|
|
90
|
+
},`,
|
|
91
|
+
`(s, svg) => {
|
|
92
|
+
const z = LitStage.zone(s.layout, "subject");
|
|
93
|
+
const w = Math.round(z.w / 9);
|
|
94
|
+
svg.innerHTML = [0, 1, 2, 3, 4].map((k) => { const h = Math.round(z.h * (0.3 + 0.12 * k) * s.enter(0.1 + k * T.stagger.item * 2, T.dur.hero)); return \`<rect x="\${Math.round(w * (1 + k * 1.6))}" y="\${Math.round(z.h * 0.9) - h}" width="\${w}" height="\${h}" fill="\${k === 4 ? "var(--lit-accent, var(--lit-signal))" : "var(--lit-signal)"}"/>\`; }).join("");
|
|
95
|
+
},`,
|
|
96
|
+
`(s, svg) => {
|
|
97
|
+
const z = LitStage.zone(s.layout, "subject");
|
|
98
|
+
const x = z.w * (0.1 + 0.8 * T.ease.move(LitStage.clamp(s.local / (s.length * 0.8))));
|
|
99
|
+
svg.innerHTML = \`<path d="M\${z.w * 0.1} \${z.h * 0.6} C \${z.w * 0.35} \${z.h * 0.2}, \${z.w * 0.65} \${z.h * 0.9}, \${z.w * 0.9} \${z.h * 0.45}" fill="none" stroke="var(--lit-line)" stroke-width="5"/><circle cx="\${x}" cy="\${z.h * 0.55}" r="\${z.h * 0.06}" fill="var(--lit-signal)"/>\`;
|
|
100
|
+
},`,
|
|
101
|
+
`(s, svg) => {
|
|
102
|
+
const z = LitStage.zone(s.layout, "subject");
|
|
103
|
+
const n = 8;
|
|
104
|
+
const c = Math.min(z.w / (n + 2), z.h / 4);
|
|
105
|
+
const cells = [];
|
|
106
|
+
for (let k = 0; k < n * 2; k++) { const e = s.enter(0.05 * k, T.dur.move); cells.push(\`<rect x="\${c * (1 + (k % n)) + c * 0.1}" y="\${z.h * 0.3 + c * Math.floor(k / n) + (1 - e) * 30}" width="\${c * 0.8}" height="\${c * 0.8}" opacity="\${e}" fill="\${k === 11 ? "var(--lit-accent, var(--lit-signal))" : "var(--lit-muted)"}"/>\`); }
|
|
107
|
+
svg.innerHTML = cells.join("");
|
|
108
|
+
},`,
|
|
109
|
+
];
|
|
110
|
+
|
|
111
|
+
/** The demo page: the scaffold with the demo drawings in its DRAW slots. */
|
|
112
|
+
export function demoPage(treatment) {
|
|
113
|
+
let k = 0;
|
|
114
|
+
return scaffoldHtml(treatment).replace(/ {4}\(s, svg, t\) => \{\},/gu, () => ` ${DEMO_DRAW[k++ % DEMO_DRAW.length]}`);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** Render the gallery: a board round per style, then one sheet of the boards. */
|
|
118
|
+
export async function stylesCommand({ out, format = "16:9", log = () => {} }) {
|
|
119
|
+
if (!["16:9", "9:16"].includes(format)) throw new Exit(EXIT.USAGE, "--format is 16:9 or 9:16");
|
|
120
|
+
mkdirSync(out, { recursive: true });
|
|
121
|
+
const boards = [];
|
|
122
|
+
const verdicts = [];
|
|
123
|
+
for (const id of STYLE_IDS) {
|
|
124
|
+
const dir = join(out, id);
|
|
125
|
+
rmSync(dir, { recursive: true, force: true });
|
|
126
|
+
mkdirSync(join(dir, "stage"), { recursive: true });
|
|
127
|
+
const demo = demoTreatment(id, format);
|
|
128
|
+
writeFileSync(join(dir, "treatment.json"), `${JSON.stringify(demo, null, 2)}\n`);
|
|
129
|
+
const treatment = loadTreatment(join(dir, "treatment.json"));
|
|
130
|
+
writeFileSync(join(dir, "stage", "index.html"), demoPage(treatment));
|
|
131
|
+
log(`styles: rendering the ${id} board`);
|
|
132
|
+
try {
|
|
133
|
+
await runStage({ outDir: dir, treatment, round: 1, stillsOnly: true, log });
|
|
134
|
+
verdicts.push(`${id}: board check PASS`);
|
|
135
|
+
} catch (error) {
|
|
136
|
+
if (!(error instanceof Exit)) throw error;
|
|
137
|
+
verdicts.push(`${id}: ${error.message.split(";")[0]}`);
|
|
138
|
+
}
|
|
139
|
+
boards.push(decodePng(readFileSync(join(dir, "stills", "board.png"))));
|
|
140
|
+
}
|
|
141
|
+
const thumbs = boards.map((b) => downscale(b.pixels, b.width, b.height, 960, 540));
|
|
142
|
+
const sheet = contactSheet(thumbs, 960, 540, 2, STYLE_IDS.map((_, i) => String(i + 1)));
|
|
143
|
+
const file = join(out, "styles.png");
|
|
144
|
+
writeFileSync(file, encodePng(sheet.width, sheet.height, sheet.pixels, 4, 6));
|
|
145
|
+
const failed = verdicts.filter((v) => !/PASS$/u.test(v));
|
|
146
|
+
return { code: failed.length ? EXIT.GATE_FAIL_QA : EXIT.OK, message: `STYLES: ${file}\n${verdicts.join("\n")}` };
|
|
147
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// The house file: `motion-house.json` beside a film's output folder (the user's working directory).
|
|
2
|
+
// A full render that passes its gate writes it, or appends the film to it; while it exists, the
|
|
3
|
+
// treatment validator holds every new film in that folder to its style unless the request names
|
|
4
|
+
// another. It is data the validator reads, so the second film starts from the first one's style
|
|
5
|
+
// without anyone having to remember it.
|
|
6
|
+
import { existsSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
7
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
8
|
+
import { readBoundedText } from "./safe-read.mjs";
|
|
9
|
+
import { STYLE_IDS } from "./styles.mjs";
|
|
10
|
+
|
|
11
|
+
export const HOUSE_FILE = "motion-house.json";
|
|
12
|
+
export const HOUSE_SCHEMA = "litcodex.motion-house/v1";
|
|
13
|
+
const MAX_FILMS = 50;
|
|
14
|
+
|
|
15
|
+
export const houseFileFor = (out) => join(dirname(resolve(out)), HOUSE_FILE);
|
|
16
|
+
|
|
17
|
+
/** The house record for an output folder, or null when there is none or it is unusable. */
|
|
18
|
+
export function readHouse(out) {
|
|
19
|
+
const file = houseFileFor(out);
|
|
20
|
+
if (!existsSync(file)) return null;
|
|
21
|
+
try {
|
|
22
|
+
const house = JSON.parse(readBoundedText(file));
|
|
23
|
+
if (house?.schema !== HOUSE_SCHEMA || !STYLE_IDS.includes(house.style)) return null;
|
|
24
|
+
return house;
|
|
25
|
+
} catch {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Record a passed film. The first film sets the house style; later films are appended. A film in a
|
|
32
|
+
* style the request named outright is appended without moving the house style.
|
|
33
|
+
*/
|
|
34
|
+
export function recordHouse(out, { style, path: renderPath, format, durationSec, now = new Date() }) {
|
|
35
|
+
const file = houseFileFor(out);
|
|
36
|
+
const house = readHouse(out) ?? { schema: HOUSE_SCHEMA, style, createdAt: now.toISOString(), films: [] };
|
|
37
|
+
const dir = basename(resolve(out));
|
|
38
|
+
const films = (Array.isArray(house.films) ? house.films : []).filter((f) => f?.dir !== dir);
|
|
39
|
+
films.push({ dir, style, path: renderPath, format, durationSec, at: now.toISOString() });
|
|
40
|
+
const next = { ...house, films: films.slice(-MAX_FILMS) };
|
|
41
|
+
const tmp = `${file}.tmp`;
|
|
42
|
+
writeFileSync(tmp, `${JSON.stringify(next, null, 2)}\n`);
|
|
43
|
+
renameSync(tmp, file);
|
|
44
|
+
return next;
|
|
45
|
+
}
|
|
@@ -146,6 +146,95 @@ export function luminancePercentile(bytes, fraction) {
|
|
|
146
146
|
return 1;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
+
/**
|
|
150
|
+
* The low and high luminance percentiles of an RGBA frame from one histogram pass: `low` is the lower
|
|
151
|
+
* edge of the bin holding the `lowFraction` quantile, `high` the upper edge of the bin holding the
|
|
152
|
+
* `highFraction` quantile (the same rule as luminancePercentile). Their
|
|
153
|
+
* spread is how much the frame holds besides one flat colour (FLAT-FRAME).
|
|
154
|
+
*/
|
|
155
|
+
export function luminanceBand(bytes, lowFraction, highFraction) {
|
|
156
|
+
const bins = new Uint32Array(1024);
|
|
157
|
+
const count = bytes.length / 4;
|
|
158
|
+
for (let i = 0; i < bytes.length; i += 4) {
|
|
159
|
+
const l = 0.2126 * LINEAR[bytes[i]] + 0.7152 * LINEAR[bytes[i + 1]] + 0.0722 * LINEAR[bytes[i + 2]];
|
|
160
|
+
bins[Math.min(1023, Math.floor(l * 1024))]++;
|
|
161
|
+
}
|
|
162
|
+
let seen = 0;
|
|
163
|
+
let low = null;
|
|
164
|
+
let high = 1;
|
|
165
|
+
for (let k = 0; k < 1024; k++) {
|
|
166
|
+
seen += bins[k];
|
|
167
|
+
if (low === null && seen >= count * lowFraction) low = k / 1024;
|
|
168
|
+
if (seen >= count * highFraction) {
|
|
169
|
+
high = (k + 1) / 1024;
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return { low: low ?? 0, high };
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const luma8 = (p, o) => Math.round(0.299 * p[o] + 0.587 * p[o + 1] + 0.114 * p[o + 2]);
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Share of 48 px cells that carry something (DEAD-AIR): a cell is busy when its luma varies (sd > 6)
|
|
180
|
+
* or its mean sits more than 16 levels off the frame's ground, the most common luma smoothed over
|
|
181
|
+
* +-3 levels. Sampled on a 3 px lattice; an opaque RGBA frame in, a 0..1 share out.
|
|
182
|
+
*/
|
|
183
|
+
export function busyShare(rgba, width, height, { cell = 48, step = 3 } = {}) {
|
|
184
|
+
const hist = new Uint32Array(256);
|
|
185
|
+
for (let y = 0; y < height; y += step) for (let x = 0; x < width; x += step) hist[luma8(rgba, (y * width + x) * 4)] += 1;
|
|
186
|
+
let ground = 0;
|
|
187
|
+
let best = -1;
|
|
188
|
+
for (let i = 0; i < 256; i++) {
|
|
189
|
+
let sum = 0;
|
|
190
|
+
for (let k = Math.max(0, i - 3); k <= Math.min(255, i + 3); k++) sum += hist[k];
|
|
191
|
+
if (sum > best) {
|
|
192
|
+
best = sum;
|
|
193
|
+
ground = i;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
let busy = 0;
|
|
197
|
+
let cells = 0;
|
|
198
|
+
for (let cy = 0; cy + cell <= height; cy += cell) {
|
|
199
|
+
for (let cx = 0; cx + cell <= width; cx += cell) {
|
|
200
|
+
let sum = 0;
|
|
201
|
+
let sq = 0;
|
|
202
|
+
let n = 0;
|
|
203
|
+
for (let y = cy; y < cy + cell; y += step)
|
|
204
|
+
for (let x = cx; x < cx + cell; x += step) {
|
|
205
|
+
const l = luma8(rgba, (y * width + x) * 4);
|
|
206
|
+
sum += l;
|
|
207
|
+
sq += l * l;
|
|
208
|
+
n += 1;
|
|
209
|
+
}
|
|
210
|
+
const mean = sum / n;
|
|
211
|
+
if (Math.sqrt(Math.max(0, sq / n - mean * mean)) > 6 || Math.abs(mean - ground) > 16) busy += 1;
|
|
212
|
+
cells += 1;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return cells ? busy / cells : 0;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// RICH-FILL: the frame cut into 4 x 3 regions, each judged by its own busyShare.
|
|
219
|
+
export const FILL_GRID = Object.freeze({ cols: 4, rows: 3 });
|
|
220
|
+
|
|
221
|
+
/** The busyShare of each region of the FILL_GRID, row by row. */
|
|
222
|
+
export function regionFill(rgba, width, height) {
|
|
223
|
+
const out = [];
|
|
224
|
+
const rw = Math.floor(width / FILL_GRID.cols);
|
|
225
|
+
const rh = Math.floor(height / FILL_GRID.rows);
|
|
226
|
+
for (let r = 0; r < FILL_GRID.rows; r++)
|
|
227
|
+
for (let c = 0; c < FILL_GRID.cols; c++) {
|
|
228
|
+
const sub = new Uint8Array(rw * rh * 4);
|
|
229
|
+
for (let y = 0; y < rh; y++) {
|
|
230
|
+
const from = ((r * rh + y) * width + c * rw) * 4;
|
|
231
|
+
sub.set(rgba.subarray(from, from + rw * 4), y * rw * 4);
|
|
232
|
+
}
|
|
233
|
+
out.push(busyShare(sub, rw, rh));
|
|
234
|
+
}
|
|
235
|
+
return out;
|
|
236
|
+
}
|
|
237
|
+
|
|
149
238
|
// A 3x5 bitmap face for contact-sheet labels only (time and frame numbers); never film type.
|
|
150
239
|
const GLYPHS = {
|
|
151
240
|
0: "111101101101111",
|