sera-code 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/NOTICE-SERA.md +25 -0
- package/README.md +27 -2
- package/THIRD_PARTY_NOTICES.md +68 -0
- package/bin/sera.mjs +137 -0
- package/dist/bundle/chunks/anthropic-messages-RD7GXOQL.js +6 -0
- package/dist/bundle/chunks/anthropic.js +75 -0
- package/dist/bundle/chunks/azure-openai-responses-CJT3KTVK.js +2 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +89 -0
- package/dist/bundle/chunks/chunk-46WGNYIE.js +82 -0
- package/dist/bundle/chunks/chunk-4UNN5OGR.js +4 -0
- package/dist/bundle/chunks/chunk-53H5DPHA.js +16 -0
- package/dist/bundle/chunks/chunk-5AGIVGSV.js +6 -0
- package/dist/bundle/chunks/chunk-6JXVX6Q2.js +2 -0
- package/dist/bundle/chunks/chunk-6QGV3IWD.js +6 -0
- package/dist/bundle/chunks/chunk-7CBJINYJ.js +20 -0
- package/dist/bundle/chunks/chunk-7DDKXS2Q.js +2 -0
- package/dist/bundle/chunks/chunk-7RZ5BS7U.js +2 -0
- package/dist/bundle/chunks/chunk-7ZC4UXSL.js +2 -0
- package/dist/bundle/chunks/chunk-BPHHHEET.js +9 -0
- package/dist/bundle/chunks/chunk-BSS6T6KQ.js +2 -0
- package/dist/bundle/chunks/chunk-CF5GWZHW.js +31 -0
- package/dist/bundle/chunks/chunk-EDSQGWII.js +44 -0
- package/dist/bundle/chunks/chunk-FFMDRXC4.js +10 -0
- package/dist/bundle/chunks/chunk-GUGC72EB.js +1222 -0
- package/dist/bundle/chunks/chunk-HODJBMOY.js +9 -0
- package/dist/bundle/chunks/chunk-HQBQWHLD.js +7 -0
- package/dist/bundle/chunks/chunk-HQJBN2MC.js +2 -0
- package/dist/bundle/chunks/chunk-JXWJOIH4.js +2 -0
- package/dist/bundle/chunks/chunk-KXU77PUU.js +4 -0
- package/dist/bundle/chunks/chunk-L2ZPNLYD.js +2 -0
- package/dist/bundle/chunks/chunk-LPXNMA2W.js +2 -0
- package/dist/bundle/chunks/chunk-LVVZS2NO.js +12 -0
- package/dist/bundle/chunks/chunk-M3LEVT3X.js +2 -0
- package/dist/bundle/chunks/chunk-P7FPUEYA.js +2 -0
- package/dist/bundle/chunks/chunk-PGXDEOVV.js +2 -0
- package/dist/bundle/chunks/chunk-PJACZCIR.js +2 -0
- package/dist/bundle/chunks/chunk-PMRZO46Y.js +2 -0
- package/dist/bundle/chunks/chunk-PRRNXB7S.js +2 -0
- package/dist/bundle/chunks/chunk-QTM7S6TH.js +2 -0
- package/dist/bundle/chunks/chunk-RDZVAGPR.js +2 -0
- package/dist/bundle/chunks/chunk-TLNP2BSO.js +2 -0
- package/dist/bundle/chunks/chunk-TMKHGABX.js +2 -0
- package/dist/bundle/chunks/chunk-TMTOQ7H7.js +2 -0
- package/dist/bundle/chunks/chunk-UKVNB6C4.js +2 -0
- package/dist/bundle/chunks/chunk-USJZMAIR.js +2 -0
- package/dist/bundle/chunks/chunk-UTB4DTYQ.js +2 -0
- package/dist/bundle/chunks/chunk-ZLAHUYDW.js +131 -0
- package/dist/bundle/chunks/chunk-ZNCN2NGY.js +60 -0
- package/dist/bundle/chunks/cli-MML2DU4A.js +51 -0
- package/dist/bundle/chunks/cloudflare-workers-ai-system-one-QPZQRBK5.js +2 -0
- package/dist/bundle/chunks/codemode-worker.js +478 -0
- package/dist/bundle/chunks/dist-ZNZCJI7B.js +7 -0
- package/dist/bundle/chunks/easter-egg-3d-VOETWRJO.js +2 -0
- package/dist/bundle/chunks/execute-HXDNZ26B.js +505 -0
- package/dist/bundle/chunks/github-copilot.js +2 -0
- package/dist/bundle/chunks/google-generative-ai-SJXMIEPZ.js +2 -0
- package/dist/bundle/chunks/google-vertex-VSXQ3BDH.js +2 -0
- package/dist/bundle/chunks/https-proxy-agent-LVOO5TPL.js +13 -0
- package/dist/bundle/chunks/image-resize-worker.js +2 -0
- package/dist/bundle/chunks/jiti-loader-GL4HJFAD.js +21 -0
- package/dist/bundle/chunks/jiti-static-loader-2RCDI6B4.js +2 -0
- package/dist/bundle/chunks/kimi-coding.js +2 -0
- package/dist/bundle/chunks/lib-4AVRLBHM.js +9 -0
- package/dist/bundle/chunks/llama-cpp-classify-4KFSGAMH.js +22 -0
- package/dist/bundle/chunks/meta.js +2 -0
- package/dist/bundle/chunks/mistral-conversations-JYWDZV2K.js +5 -0
- package/dist/bundle/chunks/multipart-parser-FMGQ7342.js +3 -0
- package/dist/bundle/chunks/node-AUOGOBCN.js +2 -0
- package/dist/bundle/chunks/node-KCMANYC2.js +16 -0
- package/dist/bundle/chunks/openai-chatgpt.js +75 -0
- package/dist/bundle/chunks/openai-codex-responses-OQV5DCFA.js +10 -0
- package/dist/bundle/chunks/openai-codex.js +75 -0
- package/dist/bundle/chunks/openai-completions-RFDJM2W5.js +7 -0
- package/dist/bundle/chunks/openai-decisions-O6PHBSCB.js +5 -0
- package/dist/bundle/chunks/openai-responses-LVNAPALQ.js +4 -0
- package/dist/bundle/chunks/openrouter-images-4WG6OOLH.js +2 -0
- package/dist/bundle/chunks/openrouter.js +75 -0
- package/dist/bundle/chunks/pdfjs-BETXZQ7A.js +108 -0
- package/dist/bundle/chunks/pdfjs-decoders-37HBPYHX.js +2 -0
- package/dist/bundle/chunks/pdfjs-jbig2-MH7WRXUP.js +2 -0
- package/dist/bundle/chunks/pdfjs-jbig2_nowasm_fallback-UVK7AQLA.js +2 -0
- package/dist/bundle/chunks/pdfjs-openjpeg-TC2QHC4G.js +2 -0
- package/dist/bundle/chunks/pdfjs-openjpeg_nowasm_fallback-ZC2FTHCZ.js +3 -0
- package/dist/bundle/chunks/pi-messages-EZXKVRR6.js +8 -0
- package/dist/bundle/chunks/radius.js +75 -0
- package/dist/bundle/chunks/runtime-JAH75CB5.js +2 -0
- package/dist/bundle/chunks/src-QKGKDFSU.js +4 -0
- package/dist/bundle/chunks/typesafe-system-one-X3JT6ECA.js +2 -0
- package/dist/bundle/chunks/virtual-modules-I5QRIHN6.js +2 -0
- package/dist/bundle/chunks/xai.js +2 -0
- package/dist/bundle/cli-runtime.js +3 -0
- package/dist/bundle/cli.js +5 -0
- package/dist/bundle/index.js +2 -0
- package/dist/bundle/rpc-entry.js +3 -0
- package/dist/core/export-html/ansi-to-html.d.ts +22 -0
- package/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
- package/dist/core/export-html/ansi-to-html.js +249 -0
- package/dist/core/export-html/ansi-to-html.js.map +1 -0
- package/dist/core/export-html/index.d.ts +37 -0
- package/dist/core/export-html/index.d.ts.map +1 -0
- package/dist/core/export-html/index.js +228 -0
- package/dist/core/export-html/index.js.map +1 -0
- package/dist/core/export-html/template.css +1085 -0
- package/dist/core/export-html/template.html +56 -0
- package/dist/core/export-html/template.js +2044 -0
- package/dist/core/export-html/tool-renderer.d.ts +34 -0
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -0
- package/dist/core/export-html/tool-renderer.js +110 -0
- package/dist/core/export-html/tool-renderer.js.map +1 -0
- package/dist/core/export-html/vendor/highlight.min.js +1213 -0
- package/dist/core/export-html/vendor/marked-cjk-friendly.min.js +6 -0
- package/dist/core/export-html/vendor/marked.min.js +79 -0
- package/dist/modes/interactive/assets/clankolas.png +0 -0
- package/dist/modes/interactive/theme/dark.json +81 -0
- package/dist/modes/interactive/theme/light.json +81 -0
- package/dist/modes/interactive/theme/system-theme.d.ts +55 -0
- package/dist/modes/interactive/theme/system-theme.d.ts.map +1 -0
- package/dist/modes/interactive/theme/system-theme.js +546 -0
- package/dist/modes/interactive/theme/system-theme.js.map +1 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts +81 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-controller.js +210 -0
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -0
- package/dist/modes/interactive/theme/theme-schema.d.ts +28 -0
- package/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-schema.js +105 -0
- package/dist/modes/interactive/theme/theme-schema.js.map +1 -0
- package/dist/modes/interactive/theme/theme-tokens.d.ts +257 -0
- package/dist/modes/interactive/theme/theme-tokens.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-tokens.js +94 -0
- package/dist/modes/interactive/theme/theme-tokens.js.map +1 -0
- package/dist/modes/interactive/theme/theme.d.ts +155 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme.js +905 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -0
- package/docs/cli-integration.md +106 -0
- package/docs/cli.md +333 -0
- package/docs/codemode.md +230 -0
- package/docs/compaction.md +463 -0
- package/docs/configuration.md +47 -0
- package/docs/containerization.md +183 -0
- package/docs/custom-provider.md +227 -0
- package/docs/docs.json +220 -0
- package/docs/environment-variables.md +102 -0
- package/docs/extensions.md +400 -0
- package/docs/how-pi-works.md +49 -0
- package/docs/index.md +39 -0
- package/docs/json.md +226 -0
- package/docs/keybindings.md +195 -0
- package/docs/llama-cpp.md +121 -0
- package/docs/mcp.md +272 -0
- package/docs/message-types.md +279 -0
- package/docs/models-configuration.md +196 -0
- package/docs/models.md +225 -0
- package/docs/nvidia-rtx-llama-cpp.md +96 -0
- package/docs/packages.md +131 -0
- package/docs/prompt-templates.md +59 -0
- package/docs/providers.md +247 -0
- package/docs/quickstart.md +136 -0
- package/docs/rpc-commands.md +860 -0
- package/docs/rpc-extension-ui.md +200 -0
- package/docs/rpc.md +193 -0
- package/docs/sdk.md +147 -0
- package/docs/security.md +99 -0
- package/docs/session-format.md +293 -0
- package/docs/sessions.md +66 -0
- package/docs/settings.md +172 -0
- package/docs/shell-aliases.md +93 -0
- package/docs/skills.md +93 -0
- package/docs/slash-commands.md +61 -0
- package/docs/terminal-setup.md +233 -0
- package/docs/termux.md +117 -0
- package/docs/themes.md +138 -0
- package/docs/tmux.md +55 -0
- package/docs/tui.md +195 -0
- package/docs/usage.md +94 -0
- package/docs/virtual-models.md +114 -0
- package/docs/windows.md +81 -0
- package/lib/auth.js +190 -0
- package/lib/provider.js +52 -0
- package/package.json +43 -5
- package/sera-core/skills/apple-tasarim/SKILL.md +48 -0
- package/sera-core/skills/apple-tasarim/referanslar/apple-hig.md +55 -0
- package/sera-core/skills/belge-yarat/SKILL.md +64 -0
- package/sera-core/skills/belge-yarat/referanslar/belge-yazim.md +60 -0
- package/sera-core/skills/derin-arastirma/SKILL.md +52 -0
- package/sera-core/skills/derin-arastirma/referanslar/arastirma-yontem.md +50 -0
- package/sera-core/skills/dusunme-dogrulama/SKILL.md +59 -0
- package/sera-core/skills/dusunme-dogrulama/referanslar/dusunme-kontrol.md +54 -0
- package/sera-core/skills/film-stilleri/SKILL.md +51 -0
- package/sera-core/skills/hyperframes/LICENSE-UPSTREAM +190 -0
- package/sera-core/skills/hyperframes/SKILL.md +79 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/biennale-yellow/FRAME.md +289 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/blockframe/FRAME.md +275 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/blue-professional/FRAME.md +307 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/bold-poster/FRAME.md +275 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/broadside/FRAME.md +284 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/capsule/FRAME.md +284 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/cartesian/FRAME.md +278 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/cobalt-grid/FRAME.md +265 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/code-editorial/FRAME.md +277 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/coral/FRAME.md +314 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/creative-mode/FRAME.md +333 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/daisy-days/FRAME.md +274 -0
- package/sera-core/skills/hyperframes/assets/frame-presets/editorial-forest/FRAME.md +265 -0
- package/sera-core/skills/hyperframes/references/captions.md +46 -0
- package/sera-core/skills/hyperframes/references/film.md +48 -0
- package/sera-core/skills/hyperframes/references/format.md +159 -0
- package/sera-core/skills/hyperframes/references/look.md +69 -0
- package/sera-core/skills/hyperframes/references/motion.md +95 -0
- package/sera-core/skills/hyperframes/references/overlays.md +39 -0
- package/sera-core/skills/hyperframes/references/path-tracing.md +36 -0
- package/sera-core/skills/hyperframes/references/plugin-installation.md +42 -0
- package/sera-core/skills/hyperframes/references/review.md +51 -0
- package/sera-core/skills/hyperframes/references/runtimes.md +69 -0
- package/sera-core/skills/hyperframes/references/skill-lifecycle.md +54 -0
- package/sera-core/skills/hyperframes/references/sound.md +43 -0
- package/sera-core/skills/hyperframes/references/spec.md +76 -0
- package/sera-core/skills/hyperframes/references/story.md +103 -0
- package/sera-core/skills/hyperframes/references/storyboard-format.md +107 -0
- package/sera-core/skills/hyperframes/references/storyboard.md +36 -0
- package/sera-core/skills/hyperframes/references/types/3d.md +25 -0
- package/sera-core/skills/hyperframes/references/types/character.md +20 -0
- package/sera-core/skills/hyperframes/references/types/data.md +19 -0
- package/sera-core/skills/hyperframes/references/types/explainer.md +34 -0
- package/sera-core/skills/hyperframes/references/types/launch.md +41 -0
- package/sera-core/skills/hyperframes/references/types/music.md +24 -0
- package/sera-core/skills/hyperframes/references/types/vertical.md +23 -0
- package/sera-core/skills/hyperframes-cli/LICENSE-UPSTREAM +190 -0
- package/sera-core/skills/hyperframes-cli/SKILL.md +99 -0
- package/sera-core/skills/hyperframes-cli/references/beats.md +17 -0
- package/sera-core/skills/hyperframes-cli/references/compare-and-batch.md +105 -0
- package/sera-core/skills/hyperframes-cli/references/conventions.md +16 -0
- package/sera-core/skills/hyperframes-cli/references/doctor-browser.md +80 -0
- package/sera-core/skills/hyperframes-cli/references/feedback.md +14 -0
- package/sera-core/skills/hyperframes-cli/references/init-and-scaffold.md +75 -0
- package/sera-core/skills/hyperframes-cli/references/lint-validate-inspect.md +164 -0
- package/sera-core/skills/hyperframes-cli/references/preview-render.md +204 -0
- package/sera-core/skills/hyperframes-cli/references/upgrade-info-misc.md +134 -0
- package/sera-core/skills/impeccable/LICENSE-UPSTREAM +191 -0
- package/sera-core/skills/impeccable/NOTICE-UPSTREAM.md +11 -0
- package/sera-core/skills/impeccable/SKILL.md +89 -0
- package/sera-core/skills/impeccable/reference/adapt.md +318 -0
- package/sera-core/skills/impeccable/reference/adapt.native.md +58 -0
- package/sera-core/skills/impeccable/reference/android.md +46 -0
- package/sera-core/skills/impeccable/reference/animate.md +89 -0
- package/sera-core/skills/impeccable/reference/audit.md +139 -0
- package/sera-core/skills/impeccable/reference/audit.native.md +139 -0
- package/sera-core/skills/impeccable/reference/bolder.md +33 -0
- package/sera-core/skills/impeccable/reference/clarify.md +94 -0
- package/sera-core/skills/impeccable/reference/colorize.md +86 -0
- package/sera-core/skills/impeccable/reference/component-review.md +63 -0
- package/sera-core/skills/impeccable/reference/craft-floor.md +44 -0
- package/sera-core/skills/impeccable/reference/craft.md +5 -0
- package/sera-core/skills/impeccable/reference/critique.md +819 -0
- package/sera-core/skills/impeccable/reference/degraded/asset-producer.md +42 -0
- package/sera-core/skills/impeccable/reference/degraded/documenter.md +24 -0
- package/sera-core/skills/impeccable/reference/degraded/finish-reviewer.md +38 -0
- package/sera-core/skills/impeccable/reference/degraded/manual-edit-applier.md +93 -0
- package/sera-core/skills/impeccable/reference/delight.md +70 -0
- package/sera-core/skills/impeccable/reference/distill.md +111 -0
- package/sera-core/skills/impeccable/reference/doctor.md +54 -0
- package/sera-core/skills/impeccable/reference/document.md +416 -0
- package/sera-core/skills/impeccable/reference/extract.md +69 -0
- package/sera-core/skills/impeccable/reference/generate.md +101 -0
- package/sera-core/skills/impeccable/reference/harden.md +362 -0
- package/sera-core/skills/impeccable/reference/hooks.md +120 -0
- package/sera-core/skills/impeccable/reference/init.md +133 -0
- package/sera-core/skills/impeccable/reference/ios.md +51 -0
- package/sera-core/skills/impeccable/reference/layout.md +84 -0
- package/sera-core/skills/impeccable/reference/live-setup.md +104 -0
- package/sera-core/skills/impeccable/reference/live.md +327 -0
- package/sera-core/skills/impeccable/reference/mode-operate.md +21 -0
- package/sera-core/skills/impeccable/reference/mode-persuade.md +19 -0
- package/sera-core/skills/impeccable/reference/mode-read.md +21 -0
- package/sera-core/skills/impeccable/reference/new-work.md +152 -0
- package/sera-core/skills/impeccable/reference/onboard.md +234 -0
- package/sera-core/skills/impeccable/reference/operate.md +61 -0
- package/sera-core/skills/impeccable/reference/optimize.md +257 -0
- package/sera-core/skills/impeccable/reference/overdrive.md +127 -0
- package/sera-core/skills/impeccable/reference/polish.md +105 -0
- package/sera-core/skills/impeccable/reference/quieter.md +99 -0
- package/sera-core/skills/impeccable/reference/region-map.md +26 -0
- package/sera-core/skills/impeccable/reference/routing.md +24 -0
- package/sera-core/skills/impeccable/reference/shape.md +59 -0
- package/sera-core/skills/impeccable/reference/typeset.md +90 -0
- package/sera-core/skills/impeccable/reference/visualize.md +47 -0
- package/sera-core/skills/oyun-yarat/SKILL.md +106 -0
- package/sera-core/skills/oyun-yarat/referanslar/3b-yaris.md +74 -0
- package/sera-core/skills/oyun-yarat/referanslar/kaplay.md +99 -0
- package/sera-core/skills/oyun-yarat/referanslar/oyun-desenleri.md +73 -0
- package/sera-core/skills/oyun-yarat/sablonlar/kaplay-2d.html +164 -0
- package/sera-core/skills/oyun-yarat/sablonlar/three-yaris.html +149 -0
- package/sera-core/skills/oyun-yarat/sablonlar/tuval-minimal.html +77 -0
- package/sera-core/skills/receiving-code-review/LICENSE-UPSTREAM +21 -0
- package/sera-core/skills/receiving-code-review/SKILL.md +205 -0
- package/sera-core/skills/refero-design/LICENSE-UPSTREAM +21 -0
- package/sera-core/skills/refero-design/SKILL.md +534 -0
- package/sera-core/skills/refero-design/references/anti-ai-slop.md +292 -0
- package/sera-core/skills/refero-design/references/color.md +563 -0
- package/sera-core/skills/refero-design/references/copywriting.md +222 -0
- package/sera-core/skills/refero-design/references/craft-details.md +525 -0
- package/sera-core/skills/refero-design/references/example-workflow.md +264 -0
- package/sera-core/skills/refero-design/references/icons.md +166 -0
- package/sera-core/skills/refero-design/references/mcp-tools.md +258 -0
- package/sera-core/skills/refero-design/references/motion.md +504 -0
- package/sera-core/skills/refero-design/references/typography.md +737 -0
- package/sera-core/skills/refero-design/references/visual-workflow.md +105 -0
- package/sera-core/skills/requesting-code-review/LICENSE-UPSTREAM +21 -0
- package/sera-core/skills/requesting-code-review/SKILL.md +95 -0
- package/sera-core/skills/requesting-code-review/code-reviewer.md +198 -0
- package/sera-core/skills/reverse-engineer-anything/DISCLAIMER.md +136 -0
- package/sera-core/skills/reverse-engineer-anything/LICENSE-REA-MIT +21 -0
- package/sera-core/skills/reverse-engineer-anything/SKILL.md +363 -0
- package/sera-core/skills/reverse-engineer-anything/THIRD_PARTY_NOTICES.md +135 -0
- package/sera-core/skills/reverse-engineer-anything/references/android-applications.md +36 -0
- package/sera-core/skills/reverse-engineer-anything/references/connection-and-recovery.md +127 -0
- package/sera-core/skills/reverse-engineer-anything/references/evidence-workflows.md +71 -0
- package/sera-core/skills/reverse-engineer-anything/references/javascript-applications.md +218 -0
- package/sera-core/skills/reverse-engineer-anything/references/native-and-artifacts.md +297 -0
- package/sera-core/skills/reverse-engineer-anything/references/runtime-observation.md +78 -0
- package/sera-core/skills/seo-audit/LICENSE-UPSTREAM +21 -0
- package/sera-core/skills/seo-audit/SKILL.md +210 -0
- package/sera-core/skills/sera-guvenlik-denetim/SKILL.md +44 -0
- package/sera-core/skills/sera-guvenlik-denetim/referanslar/guvenlik-listesi.md +33 -0
- package/sera-core/skills/sera-hata-ayikla/SKILL.md +27 -0
- package/sera-core/skills/sera-hata-ayikla/referanslar/hata-ayiklama.md +37 -0
- package/sera-core/skills/sera-kod-inceleme/SKILL.md +44 -0
- package/sera-core/skills/sera-kod-inceleme/referanslar/inceleme-listesi.md +62 -0
- package/sera-core/skills/sera-ofis-dosya/SKILL.md +27 -0
- package/sera-core/skills/sera-ofis-dosya/referanslar/ofis-dosya.md +93 -0
- package/sera-core/skills/sera-research/SKILL.md +90 -0
- package/sera-core/skills/sera-tasarim/SKILL.md +149 -0
- package/sera-core/skills/sera-teslim-sozlesmesi/SKILL.md +592 -0
- package/sera-core/skills/sera-test-yaz/SKILL.md +26 -0
- package/sera-core/skills/sera-test-yaz/referanslar/test-yazimi.md +35 -0
- package/sera-core/skills/sera-veri-gorsel/SKILL.md +65 -0
- package/sera-core/skills/sera-web-test/SKILL.md +26 -0
- package/sera-core/skills/sera-web-test/referanslar/web-test.md +44 -0
- package/sera-core/skills/sera-zamanli-gorev/SKILL.md +22 -0
- package/sera-core/skills/sera-zamanli-gorev/referanslar/zamanli-gorev.md +58 -0
- package/sera-core/skills/systematic-debugging/LICENSE-UPSTREAM +21 -0
- package/sera-core/skills/systematic-debugging/SKILL.md +283 -0
- package/sera-core/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/sera-core/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/sera-core/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/sera-core/skills/test-driven-development/LICENSE-UPSTREAM +21 -0
- package/sera-core/skills/test-driven-development/SKILL.md +330 -0
- package/sera-core/skills/test-driven-development/writing-good-tests.md +198 -0
- package/sera-core/skills/ticaret-icerik/SKILL.md +49 -0
- package/sera-core/skills/ticaret-icerik/referanslar/ticaret-icerik.md +54 -0
- package/sera-core/skills/uygulama-yarat/SKILL.md +95 -0
- package/sera-core/skills/uygulama-yarat/referanslar/uygulama-desenleri.md +63 -0
- package/sera-core/skills/uygulama-yarat/sablonlar/uygulama-tek-dosya.html +121 -0
- package/sera-core/skills/uyumluluk-denetim/SKILL.md +56 -0
- package/sera-core/skills/uyumluluk-denetim/referanslar/mevzuat-tablosu.md +65 -0
- package/sera-core/skills/veri-analizi/SKILL.md +54 -0
- package/sera-core/skills/veri-analizi/referanslar/veri-analizi-yontem.md +49 -0
- package/sera-core/skills/veri-analizi/sablonlar/profil.mjs +79 -0
- package/sera-core/skills/video-duzen/SKILL.md +50 -0
- package/sera-core/skills/video-duzen/referanslar/video-duzen.md +100 -0
- package/sera-core/skills/web-yayin-listesi/SKILL.md +115 -0
- package/sera-core/skills/writing-plans/LICENSE-UPSTREAM +21 -0
- package/sera-core/skills/writing-plans/SKILL.md +204 -0
- package/sera-core/src/action-nudge.ts +200 -0
- package/sera-core/src/agent-mode.ts +143 -0
- package/sera-core/src/agents.ts +185 -0
- package/sera-core/src/app-master.ts +275 -0
- package/sera-core/src/app-verify.ts +551 -0
- package/sera-core/src/approval.ts +131 -0
- package/sera-core/src/budget.ts +136 -0
- package/sera-core/src/command-policy.ts +808 -0
- package/sera-core/src/config.ts +135 -0
- package/sera-core/src/context-diet.ts +272 -0
- package/sera-core/src/device-id.ts +48 -0
- package/sera-core/src/dogal-arac.ts +203 -0
- package/sera-core/src/dogal-niyet.ts +173 -0
- package/sera-core/src/egress-allow.ts +52 -0
- package/sera-core/src/export.ts +124 -0
- package/sera-core/src/exposure.ts +8 -0
- package/sera-core/src/extension.ts +2416 -0
- package/sera-core/src/fs-tools.ts +444 -0
- package/sera-core/src/generated/build-rules.ts +26 -0
- package/sera-core/src/generated/zero-knowledge.ts +170 -0
- package/sera-core/src/github-agent-command.ts +133 -0
- package/sera-core/src/github-agent-engine.ts +198 -0
- package/sera-core/src/github-agent-schedule.ts +180 -0
- package/sera-core/src/github-agent.ts +669 -0
- package/sera-core/src/github-ajan-akis.ts +193 -0
- package/sera-core/src/github-ajan-gercek.ts +102 -0
- package/sera-core/src/github-tick.ts +78 -0
- package/sera-core/src/github-yedek.ts +269 -0
- package/sera-core/src/goal.ts +119 -0
- package/sera-core/src/handoff.ts +132 -0
- package/sera-core/src/hooks.ts +284 -0
- package/sera-core/src/image-tool.ts +118 -0
- package/sera-core/src/intake-brief.ts +82 -0
- package/sera-core/src/intake-core.ts +1152 -0
- package/sera-core/src/intake-hook.ts +88 -0
- package/sera-core/src/ios-build-tool.ts +134 -0
- package/sera-core/src/lazy-capability.ts +125 -0
- package/sera-core/src/lazy-mcp.ts +300 -0
- package/sera-core/src/limit-command.ts +51 -0
- package/sera-core/src/loop-brake.ts +129 -0
- package/sera-core/src/lsp.ts +618 -0
- package/sera-core/src/mcp-bridge.ts +159 -0
- package/sera-core/src/mcp-pin.ts +105 -0
- package/sera-core/src/mcp-ssrf.ts +124 -0
- package/sera-core/src/message-cap.ts +45 -0
- package/sera-core/src/no-progress.ts +177 -0
- package/sera-core/src/notebook-tool.ts +179 -0
- package/sera-core/src/ofis.ts +473 -0
- package/sera-core/src/path-guard.ts +139 -0
- package/sera-core/src/permission-bridge.ts +228 -0
- package/sera-core/src/policy-chain.ts +122 -0
- package/sera-core/src/pricing.ts +71 -0
- package/sera-core/src/proc.ts +149 -0
- package/sera-core/src/rea.ts +188 -0
- package/sera-core/src/repo-map.ts +230 -0
- package/sera-core/src/research.ts +347 -0
- package/sera-core/src/rules-memory.ts +227 -0
- package/sera-core/src/sandbox.ts +445 -0
- package/sera-core/src/server-error.ts +78 -0
- package/sera-core/src/skills.ts +268 -0
- package/sera-core/src/snapshot.ts +143 -0
- package/sera-core/src/spec-gate.ts +112 -0
- package/sera-core/src/subagent.ts +261 -0
- package/sera-core/src/teslim.ts +120 -0
- package/sera-core/src/test-fix.ts +184 -0
- package/sera-core/src/todo-question.ts +163 -0
- package/sera-core/src/turn-snapshots.ts +126 -0
- package/sera-core/src/tuval/arac.ts +338 -0
- package/sera-core/src/tuval/arsiv.ts +106 -0
- package/sera-core/src/tuval/belge.ts +216 -0
- package/sera-core/src/tuval/birlestir.ts +282 -0
- package/sera-core/src/tuval/disa.ts +235 -0
- package/sera-core/src/tuval/editor.ts +583 -0
- package/sera-core/src/tuval/film-cekirdek.ts +170 -0
- package/sera-core/src/tuval/film-disa.ts +188 -0
- package/sera-core/src/tuval/film-oynatici.ts +307 -0
- package/sera-core/src/tuval/kimlik.ts +156 -0
- package/sera-core/src/tuval/pano.ts +763 -0
- package/sera-core/src/tuval/proje.ts +728 -0
- package/sera-core/src/tuval/sistem-cekirdek.ts +167 -0
- package/sera-core/src/tuval/sistem.ts +328 -0
- package/sera-core/src/tuval/sunucu.ts +413 -0
- package/sera-core/src/tuval/uretim.ts +24 -0
- package/sera-core/src/tuval/veri-cekirdek.ts +477 -0
- package/sera-core/src/tuval/xlsx.ts +215 -0
- package/sera-core/src/tuval/zip.ts +163 -0
- package/sera-core/src/untrusted.ts +201 -0
- package/sera-core/src/video-edit-tool.ts +411 -0
- package/sera-core/src/video-tool.ts +217 -0
- package/sera-core/src/web-tools.ts +257 -0
- package/sera-core/src/zk.ts +104 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sera Tuval film cekirdegi: sahne zaman cizelgesi, kare hesabi, altyazi (SRT/VTT) ve sahne icinde kullanilan
|
|
3
|
+
* saf zaman yardimcilari (FILM_JS). Her sahne ZAMANIN SAF FONKSIYONUDUR: window.seek(t) ayni t icin ayni goruntuyu
|
|
4
|
+
* kurar (onceki cagrilardan bagimsiz), bu yuzden herhangi bir ana atlanabilir ve kare kare disa aktarilabilir.
|
|
5
|
+
* Ozgun tasarim; ucuncu taraf kodu/metni kullanilmamistir.
|
|
6
|
+
*/
|
|
7
|
+
import type { Bildirim } from "./proje.ts";
|
|
8
|
+
|
|
9
|
+
/** Sahne icinde ve testte kullanilan SAF yardimcilar. DOM'a dokunmaz; durum tutmaz (ayni girdi -> ayni cikti). */
|
|
10
|
+
export const FILM_JS = `
|
|
11
|
+
var SeraFilm=(function(){
|
|
12
|
+
function kisitla(x,a,b){return x<a?a:(x>b?b:x)}
|
|
13
|
+
function ilerleme(t,a,b){if(b<=a)return t>=b?1:0;return kisitla((t-a)/(b-a),0,1)}
|
|
14
|
+
var KOLAY={
|
|
15
|
+
dogrusal:function(x){return x},
|
|
16
|
+
giris:function(x){return x*x*x},
|
|
17
|
+
cikis:function(x){return 1-Math.pow(1-x,3)},
|
|
18
|
+
yumusak:function(x){return x<0.5?4*x*x*x:1-Math.pow(-2*x+2,3)/2},
|
|
19
|
+
yay:function(x){var c=1.70158;return 1+(c+1)*Math.pow(x-1,3)+c*Math.pow(x-1,2)}
|
|
20
|
+
};
|
|
21
|
+
function ara(t,a,b,v0,v1,kolay){var k=KOLAY[kolay||'yumusak']||KOLAY.yumusak;return v0+(v1-v0)*k(ilerleme(t,a,b))}
|
|
22
|
+
function rastgele(tohum){var s=(tohum>>>0)||1;return function(){s^=s<<13;s>>>=0;s^=s>>>17;s^=s<<5;s>>>=0;return s/4294967296}}
|
|
23
|
+
return {kisitla:kisitla,ilerleme:ilerleme,ara:ara,rastgele:rastgele,kolay:KOLAY};
|
|
24
|
+
})();
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
/** Oynatici/disa aktarici sahneye enjekte eder: sahnenin seek'i + CSS/WAAPI animasyonlari ayni ana kilitlenir. */
|
|
28
|
+
export const FILM_SEEK_JS = `
|
|
29
|
+
(function(){
|
|
30
|
+
window.__filmSeek=function(t,sure){
|
|
31
|
+
if(sure)window.sahneSuresi=sure;
|
|
32
|
+
if(typeof window.seek==='function')window.seek(t);
|
|
33
|
+
try{document.getAnimations().forEach(function(a){a.pause();a.currentTime=t*1000})}catch(e){}
|
|
34
|
+
document.documentElement.style.setProperty('--t',String(t));
|
|
35
|
+
return t;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
export interface SahneAraligi {
|
|
41
|
+
id: string;
|
|
42
|
+
ad: string;
|
|
43
|
+
baslangic: number;
|
|
44
|
+
bitis: number;
|
|
45
|
+
sure: number;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const yuvarla = (x: number) => Math.round(x * 1000) / 1000;
|
|
49
|
+
|
|
50
|
+
/** Sahneleri sirayla art arda dizer. film ayari yoksa varsayilan 3 sn. */
|
|
51
|
+
export function zamanCizelgesi(b: Bildirim): SahneAraligi[] {
|
|
52
|
+
let t = 0;
|
|
53
|
+
return b.artboardlar.map((a) => {
|
|
54
|
+
const sure = b.film?.sureler[a.id] ?? 3;
|
|
55
|
+
const r = { id: a.id, ad: a.ad, baslangic: yuvarla(t), bitis: yuvarla(t + sure), sure };
|
|
56
|
+
t += sure;
|
|
57
|
+
return r;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function toplamSure(b: Bildirim): number {
|
|
62
|
+
const c = zamanCizelgesi(b);
|
|
63
|
+
return c.length ? c[c.length - 1]!.bitis : 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Film zamani -> hangi sahne ve sahne-ici yerel zaman. Aralik disi t sinira kirpilir (son kare, son sahnede kalir). */
|
|
67
|
+
export function anaGoreSahne(b: Bildirim, t: number): { index: number; id: string; yerel: number } {
|
|
68
|
+
const c = zamanCizelgesi(b);
|
|
69
|
+
if (!c.length) throw new Error("Filmde sahne yok.");
|
|
70
|
+
const toplam = c[c.length - 1]!.bitis;
|
|
71
|
+
const tt = Math.min(Math.max(0, Number.isFinite(t) ? t : 0), toplam);
|
|
72
|
+
for (let i = 0; i < c.length; i++) {
|
|
73
|
+
const s = c[i]!;
|
|
74
|
+
if (tt < s.bitis || i === c.length - 1)
|
|
75
|
+
return { index: i, id: s.id, yerel: yuvarla(Math.min(tt - s.baslangic, s.sure)) };
|
|
76
|
+
}
|
|
77
|
+
throw new Error("unreachable");
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** Disa aktarilacak kare sayisi (en az 1). */
|
|
81
|
+
export function kareSayisi(toplam: number, fps: number): number {
|
|
82
|
+
return Math.max(1, Math.round(toplam * fps));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** i. karenin film zamani (sn). */
|
|
86
|
+
export const kareZamani = (i: number, fps: number): number => i / fps;
|
|
87
|
+
|
|
88
|
+
// ---------------------------------------------------------------- altyazi
|
|
89
|
+
|
|
90
|
+
function ts(sn: number, ayrac: "," | "."): string {
|
|
91
|
+
const ms = Math.round(sn * 1000);
|
|
92
|
+
const h = Math.floor(ms / 3_600_000);
|
|
93
|
+
const m = Math.floor((ms % 3_600_000) / 60_000);
|
|
94
|
+
const s = Math.floor((ms % 60_000) / 1000);
|
|
95
|
+
const k = ms % 1000;
|
|
96
|
+
const p = (n: number, u = 2) => String(n).padStart(u, "0");
|
|
97
|
+
return `${p(h)}:${p(m)}:${p(s)}${ayrac}${p(k, 3)}`;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface Altyazi {
|
|
101
|
+
baslangic: number;
|
|
102
|
+
bitis: number;
|
|
103
|
+
metin: string;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** Her sahnenin anlatim metnini cumlelere boler; sahne suresini karakter oraninda paylastirir. */
|
|
107
|
+
export function altyaziKuyruklari(b: Bildirim): Altyazi[] {
|
|
108
|
+
const cikti: Altyazi[] = [];
|
|
109
|
+
for (const s of zamanCizelgesi(b)) {
|
|
110
|
+
const metin = b.film?.anlatim?.[s.id]?.replace(/\s+/g, " ").trim();
|
|
111
|
+
if (!metin) continue;
|
|
112
|
+
const cumleler = metin
|
|
113
|
+
.match(/[^.!?…]+[.!?…]*/g)
|
|
114
|
+
?.map((x) => x.trim())
|
|
115
|
+
.filter(Boolean) ?? [metin];
|
|
116
|
+
const agirlik = cumleler.map((c) => Math.max(1, c.length));
|
|
117
|
+
const top = agirlik.reduce((x, y) => x + y, 0);
|
|
118
|
+
let t = s.baslangic;
|
|
119
|
+
cumleler.forEach((c, i) => {
|
|
120
|
+
const sonu = i === cumleler.length - 1 ? s.bitis : yuvarla(t + (s.sure * agirlik[i]!) / top);
|
|
121
|
+
cikti.push({ baslangic: yuvarla(t), bitis: sonu, metin: c });
|
|
122
|
+
t = sonu;
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
return cikti;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export function srtUret(b: Bildirim): string {
|
|
129
|
+
return altyaziKuyruklari(b)
|
|
130
|
+
.map((c, i) => `${i + 1}\n${ts(c.baslangic, ",")} --> ${ts(c.bitis, ",")}\n${c.metin}\n`)
|
|
131
|
+
.join("\n");
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export function vttUret(b: Bildirim): string {
|
|
135
|
+
return `WEBVTT\n\n${altyaziKuyruklari(b)
|
|
136
|
+
.map((c) => `${ts(c.baslangic, ".")} --> ${ts(c.bitis, ".")}\n${c.metin}\n`)
|
|
137
|
+
.join("\n")}`;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// ---------------------------------------------------------------- sahne iskeleti
|
|
141
|
+
|
|
142
|
+
const temizle = (s: string) => s.replace(/[<>&"]/g, "");
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Gecerli, baglamsiz (CDN yok) tek dosyalik sahne: 1920x1080, baslik + alt metin giris/cikis animasyonu.
|
|
146
|
+
* `sure` saniye: son 0.4 sn'de sahne kararir (geciste sert kesme olmasin).
|
|
147
|
+
*/
|
|
148
|
+
export function sahneIskeleti(ad: string, sure: number): string {
|
|
149
|
+
return `<!doctype html>
|
|
150
|
+
<html lang="tr"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
|
151
|
+
<title>${temizle(ad)}</title>
|
|
152
|
+
<style>:root{--zemin:#10302a;--metin:#fdfcf8;--vurgu:#f2c14e}
|
|
153
|
+
*{box-sizing:border-box}body{margin:0;width:1920px;height:1080px;overflow:hidden;background:var(--zemin);color:var(--metin);font-family:system-ui,"Segoe UI",sans-serif}
|
|
154
|
+
main{position:absolute;inset:0;display:flex;flex-direction:column;justify-content:center;padding:0 160px;gap:32px}
|
|
155
|
+
h1{font-size:120px;line-height:1.1;margin:0;max-width:1400px}p{font-size:48px;line-height:1.35;margin:0;color:var(--vurgu);max-width:1200px}
|
|
156
|
+
#perde{position:absolute;inset:0;background:#000;opacity:0;pointer-events:none}</style></head>
|
|
157
|
+
<body><main id="icerik"><h1 id="baslik">${temizle(ad)}</h1><p id="alt">Tek fikir, kisa cumle.</p></main><div id="perde"></div>
|
|
158
|
+
<script>${FILM_JS}
|
|
159
|
+
var SURE=${sure};
|
|
160
|
+
/* Sahne = zamanin saf fonksiyonu: ayni t her zaman ayni goruntuyu kurar; durum tutma, Math.random kullanma (SeraFilm.rastgele(tohum)). */
|
|
161
|
+
window.seek=function(t){
|
|
162
|
+
var S=window.sahneSuresi||SURE,F=SeraFilm,b=document.getElementById('baslik'),a=document.getElementById('alt'),p=document.getElementById('perde');
|
|
163
|
+
b.style.opacity=F.ara(t,0.1,0.7,0,1,'cikis');b.style.transform='translateY('+F.ara(t,0.1,0.7,40,0,'cikis')+'px)';
|
|
164
|
+
a.style.opacity=F.ara(t,0.5,1.1,0,1,'cikis');a.style.transform='translateY('+F.ara(t,0.5,1.1,40,0,'cikis')+'px)';
|
|
165
|
+
p.style.opacity=F.ara(t,S-0.4,S,0,0.9,'dogrusal');
|
|
166
|
+
};
|
|
167
|
+
window.seek(0);
|
|
168
|
+
</script></body></html>
|
|
169
|
+
`;
|
|
170
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Film disa aktarma: kare kare seek(t) ekran goruntusu (Playwright-core + sistemdeki Edge/Chrome) -> ffmpeg ile MP4/GIF.
|
|
3
|
+
* ffmpeg BUNDLE EDILMEZ (ffmpeg-static GPL; GPL kod pakete sokulmaz): sistemde yoksa acik Turkce hata verilir.
|
|
4
|
+
* SRT/VTT altyazi tarayici ve ffmpeg gerektirmez.
|
|
5
|
+
*/
|
|
6
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
7
|
+
import { existsSync, mkdirSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
8
|
+
import { join } from "node:path";
|
|
9
|
+
import { pathToFileURL } from "node:url";
|
|
10
|
+
import { type Baslatici, sistemBaslatici } from "./disa.ts";
|
|
11
|
+
import {
|
|
12
|
+
anaGoreSahne,
|
|
13
|
+
FILM_SEEK_JS,
|
|
14
|
+
kareSayisi,
|
|
15
|
+
kareZamani,
|
|
16
|
+
srtUret,
|
|
17
|
+
toplamSure,
|
|
18
|
+
vttUret,
|
|
19
|
+
zamanCizelgesi,
|
|
20
|
+
} from "./film-cekirdek.ts";
|
|
21
|
+
import { type Bildirim, bildirimOku, kokIci } from "./proje.ts";
|
|
22
|
+
|
|
23
|
+
export type FilmBicim = "mp4" | "gif" | "srt" | "vtt";
|
|
24
|
+
export const FILM_BICIMLERI: FilmBicim[] = ["mp4", "gif", "srt", "vtt"];
|
|
25
|
+
|
|
26
|
+
export const FFMPEG_YOK =
|
|
27
|
+
"ffmpeg gerekli: MP4/GIF kodlamak icin sistemde ffmpeg kurulu olmali (Windows: `winget install Gyan.FFmpeg`, macOS: `brew install ffmpeg`, Linux: paket yoneticisi). Kurduktan sonra yeniden deneyin. Altyazi (srt/vtt) ve PNG/PDF ffmpeg istemez.";
|
|
28
|
+
|
|
29
|
+
export interface FilmSonuc {
|
|
30
|
+
bicim: FilmBicim;
|
|
31
|
+
dosya: string;
|
|
32
|
+
boyut: number;
|
|
33
|
+
kare?: number;
|
|
34
|
+
sure?: number;
|
|
35
|
+
fps?: number;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** ffmpeg yolunu bulur: SERA_FFMPEG, sonra PATH. Yoksa null. */
|
|
39
|
+
export function ffmpegBul(): string | null {
|
|
40
|
+
const adaylar = [process.env.SERA_FFMPEG, "ffmpeg"].filter(Boolean) as string[];
|
|
41
|
+
for (const k of adaylar) {
|
|
42
|
+
try {
|
|
43
|
+
const r = spawnSync(k, ["-version"], { stdio: "ignore", windowsHide: true });
|
|
44
|
+
if (r.status === 0) return k;
|
|
45
|
+
} catch {
|
|
46
|
+
// sonraki aday
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type FfmpegCalistir = (ffmpeg: string, args: string[]) => Promise<void>;
|
|
53
|
+
const gercekFfmpeg: FfmpegCalistir = (ffmpeg, args) =>
|
|
54
|
+
new Promise((ok, hata) => {
|
|
55
|
+
const c = spawn(ffmpeg, args, { stdio: ["ignore", "ignore", "pipe"], windowsHide: true });
|
|
56
|
+
let err = "";
|
|
57
|
+
c.stderr.on("data", (d: Buffer) => {
|
|
58
|
+
err = (err + d.toString()).slice(-4000);
|
|
59
|
+
});
|
|
60
|
+
c.on("error", (e) => hata(new Error(`ffmpeg calistirilamadi: ${e.message}`)));
|
|
61
|
+
c.on("close", (kod) =>
|
|
62
|
+
kod === 0 ? ok() : hata(new Error(`ffmpeg hata verdi (kod ${kod}): ${err.split("\n").slice(-6).join(" | ")}`)),
|
|
63
|
+
);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
export interface FilmSecenek {
|
|
67
|
+
fps?: number;
|
|
68
|
+
/** test: ffmpeg yerine */
|
|
69
|
+
ffmpegCalistir?: FfmpegCalistir;
|
|
70
|
+
/** test: ffmpeg bulma atlansin */
|
|
71
|
+
ffmpegYol?: string;
|
|
72
|
+
/** GIF genisligi (px) */
|
|
73
|
+
gifGenislik?: number;
|
|
74
|
+
ilerleme?: (kare: number, toplam: number) => void;
|
|
75
|
+
signal?: AbortSignal;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function dosyaAdi(b: Bildirim): string {
|
|
79
|
+
return b.ad.replace(/[^\p{L}\p{N}._-]+/gu, "_").slice(0, 60) || "film";
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export async function filmDisaAktar(
|
|
83
|
+
kok: string,
|
|
84
|
+
bicim: FilmBicim,
|
|
85
|
+
baslat: Baslatici = sistemBaslatici,
|
|
86
|
+
sec: FilmSecenek = {},
|
|
87
|
+
): Promise<FilmSonuc> {
|
|
88
|
+
const b = bildirimOku(kok);
|
|
89
|
+
if (b.tur !== "film") throw new Error("Bu proje bir film degil.");
|
|
90
|
+
const out = join(kok, "cikti");
|
|
91
|
+
mkdirSync(out, { recursive: true });
|
|
92
|
+
const ad = dosyaAdi(b);
|
|
93
|
+
if (bicim === "srt" || bicim === "vtt") {
|
|
94
|
+
const dosya = join(out, `${ad}.${bicim}`);
|
|
95
|
+
const metin = bicim === "srt" ? srtUret(b) : vttUret(b);
|
|
96
|
+
if (!metin.replace("WEBVTT", "").trim())
|
|
97
|
+
throw new Error("Altyazi icin sahnelere anlatim metni (film.anlatim) yazilmali.");
|
|
98
|
+
writeFileSync(dosya, metin, "utf8");
|
|
99
|
+
return { bicim, dosya, boyut: Buffer.byteLength(metin) };
|
|
100
|
+
}
|
|
101
|
+
const ffmpeg = sec.ffmpegYol ?? ffmpegBul();
|
|
102
|
+
if (!ffmpeg) throw new Error(FFMPEG_YOK);
|
|
103
|
+
const fps = Math.round(sec.fps ?? (bicim === "gif" ? Math.min(15, b.film?.fps ?? 30) : (b.film?.fps ?? 30)));
|
|
104
|
+
const toplam = toplamSure(b);
|
|
105
|
+
const N = kareSayisi(toplam, fps);
|
|
106
|
+
const kareDizin = join(out, ".kareler");
|
|
107
|
+
rmSync(kareDizin, { recursive: true, force: true });
|
|
108
|
+
mkdirSync(kareDizin, { recursive: true });
|
|
109
|
+
const cizelge = zamanCizelgesi(b);
|
|
110
|
+
const tarayici = await baslat();
|
|
111
|
+
try {
|
|
112
|
+
const sayfa = await tarayici.newPage();
|
|
113
|
+
let mevcut = "";
|
|
114
|
+
for (let i = 0; i < N; i++) {
|
|
115
|
+
if (sec.signal?.aborted) throw new Error("Disa aktarma iptal edildi.");
|
|
116
|
+
const t = kareZamani(i, fps);
|
|
117
|
+
const s = anaGoreSahne(b, t);
|
|
118
|
+
const art = b.artboardlar[s.index]!;
|
|
119
|
+
if (mevcut !== art.id) {
|
|
120
|
+
await sayfa.setViewportSize({ width: art.genislik, height: art.yukseklik });
|
|
121
|
+
await sayfa.goto(pathToFileURL(kokIci(kok, art.dosya)).href, { waitUntil: "load" });
|
|
122
|
+
await sayfa.evaluate("document.fonts ? document.fonts.ready.then(()=>true) : true");
|
|
123
|
+
await sayfa.evaluate(FILM_SEEK_JS);
|
|
124
|
+
mevcut = art.id;
|
|
125
|
+
}
|
|
126
|
+
await sayfa.evaluate(`window.__filmSeek(${s.yerel},${cizelge[s.index]!.sure})`);
|
|
127
|
+
await sayfa.screenshot({ path: join(kareDizin, `k${String(i).padStart(6, "0")}.png`), type: "png" });
|
|
128
|
+
sec.ilerleme?.(i + 1, N);
|
|
129
|
+
}
|
|
130
|
+
} finally {
|
|
131
|
+
await tarayici.close();
|
|
132
|
+
}
|
|
133
|
+
const calistir = sec.ffmpegCalistir ?? gercekFfmpeg;
|
|
134
|
+
const dosya = join(out, `${ad}.${bicim}`);
|
|
135
|
+
rmSync(dosya, { force: true });
|
|
136
|
+
const girdi = [
|
|
137
|
+
"-y",
|
|
138
|
+
"-hide_banner",
|
|
139
|
+
"-loglevel",
|
|
140
|
+
"error",
|
|
141
|
+
"-framerate",
|
|
142
|
+
String(fps),
|
|
143
|
+
"-i",
|
|
144
|
+
join(kareDizin, "k%06d.png"),
|
|
145
|
+
];
|
|
146
|
+
let args: string[];
|
|
147
|
+
if (bicim === "mp4") {
|
|
148
|
+
const ses = b.film?.ses;
|
|
149
|
+
const sesYol = ses ? kokIci(kok, ses.dosya) : undefined;
|
|
150
|
+
if (ses && sesYol && !existsSync(sesYol)) throw new Error(`Ses dosyasi yok: ${ses.dosya}`);
|
|
151
|
+
args = [
|
|
152
|
+
...girdi,
|
|
153
|
+
...(ses && sesYol ? ["-itsoffset", String(ses.baslangic), "-i", sesYol] : []),
|
|
154
|
+
"-vf",
|
|
155
|
+
"scale=trunc(iw/2)*2:trunc(ih/2)*2,format=yuv420p",
|
|
156
|
+
"-c:v",
|
|
157
|
+
"libx264",
|
|
158
|
+
"-preset",
|
|
159
|
+
"veryfast",
|
|
160
|
+
"-crf",
|
|
161
|
+
"20",
|
|
162
|
+
"-r",
|
|
163
|
+
String(fps),
|
|
164
|
+
...(ses ? ["-c:a", "aac", "-b:a", "160k", "-map", "0:v:0", "-map", "1:a:0"] : []),
|
|
165
|
+
"-t",
|
|
166
|
+
String(toplam),
|
|
167
|
+
"-movflags",
|
|
168
|
+
"+faststart",
|
|
169
|
+
dosya,
|
|
170
|
+
];
|
|
171
|
+
} else {
|
|
172
|
+
const g = sec.gifGenislik ?? 960;
|
|
173
|
+
args = [
|
|
174
|
+
...girdi,
|
|
175
|
+
"-vf",
|
|
176
|
+
`fps=${fps},scale=${g}:-1:flags=lanczos,split[s0][s1];[s0]palettegen=max_colors=128[p];[s1][p]paletteuse=dither=bayer:bayer_scale=4`,
|
|
177
|
+
"-loop",
|
|
178
|
+
"0",
|
|
179
|
+
dosya,
|
|
180
|
+
];
|
|
181
|
+
}
|
|
182
|
+
try {
|
|
183
|
+
await calistir(ffmpeg, args);
|
|
184
|
+
} finally {
|
|
185
|
+
rmSync(kareDizin, { recursive: true, force: true });
|
|
186
|
+
}
|
|
187
|
+
return { bicim, dosya, boyut: existsSync(dosya) ? statSync(dosya).size : 0, kare: N, sure: toplam, fps };
|
|
188
|
+
}
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sera Tuval film oynaticisi: TEK dosya, kutuphanesiz. Oynat/duraklat, zaman cizelgesi, sahne suresini surukleyerek
|
|
3
|
+
* degistirme, metni yerinde duzeltme, zaman damgali (ANA bagli) yorum birakma.
|
|
4
|
+
* Istemci kodunda ters tirnak ve dolar-suslu gosterim KULLANMAYIN (String.raw sablonu icinde).
|
|
5
|
+
* Ozgun tasarim; ucuncu taraf kodu/metni kullanilmamistir.
|
|
6
|
+
*/
|
|
7
|
+
import { TEMEL_CSS } from "./editor.ts";
|
|
8
|
+
import { FILM_SEEK_JS } from "./film-cekirdek.ts";
|
|
9
|
+
|
|
10
|
+
const CSS = `
|
|
11
|
+
body{overflow:auto}
|
|
12
|
+
#kabuk{display:grid;grid-template-rows:auto 1fr;min-height:100vh}
|
|
13
|
+
header{display:flex;flex-wrap:wrap;gap:8px;align-items:center;padding:10px 16px;background:var(--yuzey);border-bottom:1px solid var(--cizgi)}
|
|
14
|
+
header h1{font-size:15px;margin:0 8px 0 0;font-weight:650}
|
|
15
|
+
.bosluk{flex:1}
|
|
16
|
+
#zaman{font-variant-numeric:tabular-nums;color:var(--soluk);min-width:110px}
|
|
17
|
+
#govde{display:grid;grid-template-columns:1fr 320px;min-height:0}
|
|
18
|
+
#orta{padding:16px;display:flex;flex-direction:column;gap:12px;min-width:0}
|
|
19
|
+
#sahne{position:relative;background:#000;border-radius:6px;overflow:hidden;width:100%}
|
|
20
|
+
#sahne iframe{position:absolute;left:0;top:0;border:0;transform-origin:0 0;background:#fff;visibility:hidden}
|
|
21
|
+
#sahne iframe.aktif{visibility:visible}
|
|
22
|
+
#altyazi{min-height:24px;color:var(--soluk);text-align:center}
|
|
23
|
+
#cizelge{position:relative;height:56px;display:flex;user-select:none;touch-action:none}
|
|
24
|
+
.seg{position:relative;height:40px;margin-top:8px;background:var(--vurgu-ac);border:1px solid var(--vurgu);color:var(--vurgu);overflow:hidden;white-space:nowrap;font-size:12px;padding:2px 6px;min-width:6px;cursor:pointer}
|
|
25
|
+
.seg:first-child{border-radius:8px 0 0 8px}.seg.son{border-radius:0 8px 8px 0}
|
|
26
|
+
.tutamac{position:relative;width:12px;margin:4px -6px 0;height:48px;z-index:3;cursor:ew-resize;background:transparent;border:0;padding:0;min-height:0}
|
|
27
|
+
.tutamac::after{content:"";position:absolute;left:4px;top:6px;bottom:6px;width:4px;border-radius:2px;background:var(--vurgu)}
|
|
28
|
+
.tutamac:disabled{cursor:default}.tutamac:disabled::after{background:var(--cizgi)}
|
|
29
|
+
#imlec{position:absolute;top:0;bottom:0;width:2px;background:var(--yorum);z-index:4;pointer-events:none}
|
|
30
|
+
.pin{position:absolute;top:-2px;width:14px;height:14px;margin-left:-7px;border-radius:50%;background:var(--yorum);border:2px solid #fff;z-index:5;cursor:pointer;padding:0;min-height:0}
|
|
31
|
+
.pin.cozuldu{background:#7a7a72}
|
|
32
|
+
#yorum-form{display:flex;gap:8px;align-items:flex-end}
|
|
33
|
+
#yorum-form textarea{min-height:40px;resize:vertical}
|
|
34
|
+
aside{border-left:1px solid var(--cizgi);background:var(--yuzey);overflow:auto;padding:12px;display:flex;flex-direction:column;gap:10px}
|
|
35
|
+
aside h2{font-size:13px;margin:0;color:var(--soluk);font-weight:600}
|
|
36
|
+
.kart{border:1px solid var(--cizgi);border-radius:10px;padding:10px;background:var(--zemin)}
|
|
37
|
+
.kart .ust{display:flex;gap:8px;align-items:center;margin-bottom:4px;font-size:12px;color:var(--soluk)}
|
|
38
|
+
.an{border-radius:999px;padding:1px 8px;background:var(--vurgu-ac);color:var(--vurgu);font-size:12px;cursor:pointer;border:0;min-height:0}
|
|
39
|
+
.rozet{border-radius:999px;padding:1px 8px;background:var(--yuzey2);font-size:11px}
|
|
40
|
+
.yanit{margin-top:6px;padding:6px 8px;border-left:3px solid var(--vurgu);background:var(--yuzey);border-radius:0 6px 6px 0;font-size:13px}
|
|
41
|
+
.bos{color:var(--soluk);font-size:13px}
|
|
42
|
+
#bildirim{position:fixed;left:50%;bottom:18px;transform:translateX(-50%);background:var(--metin);color:var(--zemin);padding:8px 16px;border-radius:999px;z-index:50;display:none}
|
|
43
|
+
@media (max-width:760px){#govde{grid-template-columns:1fr}aside{border-left:0;border-top:1px solid var(--cizgi)}#orta{padding:12px 16px}header{padding:8px 16px}}
|
|
44
|
+
`;
|
|
45
|
+
|
|
46
|
+
const JS = String.raw`
|
|
47
|
+
(function(){
|
|
48
|
+
var M=location.pathname.match(/^\/t\/[^\/]+\//)[0];
|
|
49
|
+
var S={bld:null,yorumlar:[],hashler:{},rol:'sahip',t:0,oynuyor:false,hazir:{},aktif:-1,sonSecim:null,duzenleniyor:false,surukle:null};
|
|
50
|
+
var T=window.__film={yenileme:0,kayitlar:0,sureDegisimi:0,durum:function(){return {t:S.t,oynuyor:S.oynuyor,aktif:S.aktif}}};
|
|
51
|
+
var SEEK=SEEK_KOD;
|
|
52
|
+
function $(s,k){return (k||document).querySelector(s)}
|
|
53
|
+
function esc(s){return String(s).replace(/[&<>"]/g,function(c){return {'&':'&','<':'<','>':'>','"':'"'}[c]})}
|
|
54
|
+
function api(yol,govde){
|
|
55
|
+
var o=govde?{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(govde)}:{};
|
|
56
|
+
return fetch(M+'api/'+yol,o).then(function(r){return r.json().then(function(j){if(!r.ok)throw new Error(j.hata||'Hata');return j})});
|
|
57
|
+
}
|
|
58
|
+
function haber(m){var b=$('#bildirim');b.textContent=m;b.style.display='block';clearTimeout(haber.t);haber.t=setTimeout(function(){b.style.display='none'},2600)}
|
|
59
|
+
function yazabilir(){return S.rol==='sahip'||S.rol==='duzenleyici'}
|
|
60
|
+
function yorumlayabilir(){return yazabilir()||S.rol==='yorumcu'}
|
|
61
|
+
function norm(s){return (s||'').replace(/\s+/g,' ').trim()}
|
|
62
|
+
function sn(x){x=Math.max(0,x);var m=Math.floor(x/60),s=x-m*60;return m+':'+(s<10?'0':'')+s.toFixed(1)}
|
|
63
|
+
|
|
64
|
+
function cizelge(){var c=[],t=0;S.bld.artboardlar.forEach(function(a){var s=(S.bld.film&&S.bld.film.sureler[a.id])||3;c.push({id:a.id,ad:a.ad,bas:t,bit:t+s,sure:s,a:a});t+=s});return c}
|
|
65
|
+
function toplam(){var c=cizelge();return c.length?c[c.length-1].bit:0}
|
|
66
|
+
function sahneBul(t){var c=cizelge(),i;t=Math.min(Math.max(0,t),toplam());for(i=0;i<c.length;i++){if(t<c[i].bit||i===c.length-1)return {i:i,yerel:Math.min(t-c[i].bas,c[i].sure),c:c[i]}}}
|
|
67
|
+
|
|
68
|
+
function yukle(){
|
|
69
|
+
return api('durum').then(function(d){
|
|
70
|
+
if(d.bildirim.tur!=='film'){location.replace(M);return}
|
|
71
|
+
S.bld=d.bildirim;S.yorumlar=d.yorumlar;S.hashler=d.hashler||{};S.rol=d.rol||'sahip';
|
|
72
|
+
$('#ad').textContent=d.bildirim.ad;
|
|
73
|
+
var gizle=!yorumlayabilir();$('#yorum-form').style.display=gizle?'none':'flex';
|
|
74
|
+
$('#gonder').style.display=yazabilir()?'':'none';
|
|
75
|
+
$('#rol-not').textContent=S.rol==='izleyici'?'Yalnız izleyebilirsiniz.':(S.rol==='yorumcu'?'Yorum bırakabilirsiniz.':'');
|
|
76
|
+
sahneKur();cizelgeCiz();yorumCiz();git(S.t,true);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* ---- sahneler: her sahne kendi iframe'inde; hepsi onceden yuklenir, yalniz etkin olan gorunur ---- */
|
|
81
|
+
var sahneAnahtar='';
|
|
82
|
+
function sahneKur(){
|
|
83
|
+
var anahtar=S.bld.artboardlar.map(function(a){return a.id+':'+a.genislik+'x'+a.yukseklik+':'+(S.hashler[a.id]||'')}).join('|');
|
|
84
|
+
if(anahtar===sahneAnahtar)return;sahneAnahtar=anahtar;
|
|
85
|
+
var k=$('#sahne');k.innerHTML='';S.hazir={};S.aktif=-1;
|
|
86
|
+
var a0=S.bld.artboardlar[0];k.style.aspectRatio=a0.genislik+' / '+a0.yukseklik;
|
|
87
|
+
S.bld.artboardlar.forEach(function(a,i){
|
|
88
|
+
var f=document.createElement('iframe');f.title=a.ad;f.width=a.genislik;f.height=a.yukseklik;f.dataset.id=a.id;
|
|
89
|
+
f.addEventListener('load',function(){
|
|
90
|
+
try{f.contentWindow.eval(SEEK)}catch(e){}
|
|
91
|
+
S.hazir[a.id]=true;ayarla(f);baglaDuzenle(f,a);
|
|
92
|
+
if(S.aktif===i)git(S.t,true);
|
|
93
|
+
});
|
|
94
|
+
f.src=M+'a/'+encodeURIComponent(a.id)+'?t='+Date.now();
|
|
95
|
+
k.appendChild(f);
|
|
96
|
+
});
|
|
97
|
+
olcekle();
|
|
98
|
+
}
|
|
99
|
+
function ayarla(f){var z=$('#sahne').clientWidth/f.width;f.style.transform='scale('+z+')'}
|
|
100
|
+
function olcekle(){[].forEach.call(document.querySelectorAll('#sahne iframe'),ayarla)}
|
|
101
|
+
addEventListener('resize',function(){olcekle();cizelgeCiz()});
|
|
102
|
+
|
|
103
|
+
/* ---- zaman: git(t) herhangi bir ana atlar (sahne = zamanin saf fonksiyonu) ---- */
|
|
104
|
+
function git(t,zorla){
|
|
105
|
+
if(!S.bld)return;
|
|
106
|
+
S.t=Math.min(Math.max(0,t),toplam());
|
|
107
|
+
var s=sahneBul(S.t);if(!s)return;
|
|
108
|
+
var ifr=document.querySelectorAll('#sahne iframe');
|
|
109
|
+
if(S.aktif!==s.i||zorla){[].forEach.call(ifr,function(f,i){f.classList.toggle('aktif',i===s.i)});S.aktif=s.i}
|
|
110
|
+
var f=ifr[s.i];
|
|
111
|
+
if(f&&S.hazir[s.c.id]&&!S.duzenleniyor){try{f.contentWindow.__filmSeek(s.yerel,s.c.sure)}catch(e){}}
|
|
112
|
+
$('#zaman').textContent=sn(S.t)+' / '+sn(toplam());
|
|
113
|
+
var im=$('#imlec');if(im)im.style.left=(toplam()?S.t/toplam()*100:0)+'%';
|
|
114
|
+
var an=S.bld.film&&S.bld.film.anlatim&&S.bld.film.anlatim[s.c.id];$('#altyazi').textContent=an||'';
|
|
115
|
+
sesSenkron(false);
|
|
116
|
+
}
|
|
117
|
+
var son=0;
|
|
118
|
+
function dongu(ts){
|
|
119
|
+
if(!S.oynuyor)return;
|
|
120
|
+
var dt=(ts-son)/1000;son=ts;
|
|
121
|
+
var yeni=S.t+dt;
|
|
122
|
+
if(yeni>=toplam()){git(toplam());durdur();return}
|
|
123
|
+
git(yeni);requestAnimationFrame(dongu);
|
|
124
|
+
}
|
|
125
|
+
function oynat(){
|
|
126
|
+
if(S.oynuyor)return;
|
|
127
|
+
if(S.t>=toplam())S.t=0;
|
|
128
|
+
S.oynuyor=true;$('#oynat').textContent='Duraklat';$('#oynat').setAttribute('aria-pressed','true');
|
|
129
|
+
son=performance.now();sesSenkron(true);requestAnimationFrame(dongu);
|
|
130
|
+
}
|
|
131
|
+
function durdur(){S.oynuyor=false;$('#oynat').textContent='Oynat';$('#oynat').setAttribute('aria-pressed','false');var a=$('#ses');if(a)a.pause()}
|
|
132
|
+
function sesSenkron(zorla){
|
|
133
|
+
var a=$('#ses');if(!a||!S.bld.film||!S.bld.film.ses)return;
|
|
134
|
+
var bas=S.bld.film.ses.baslangic||0,hedef=S.t-bas;
|
|
135
|
+
if(hedef<0){a.pause();return}
|
|
136
|
+
if(zorla||Math.abs(a.currentTime-hedef)>0.4){try{a.currentTime=hedef}catch(e){}}
|
|
137
|
+
if(S.oynuyor&&a.paused){var p=a.play();if(p&&p.catch)p.catch(function(){})}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/* ---- zaman cizelgesi + surukleyerek sure degistirme ---- */
|
|
141
|
+
function cizelgeCiz(){
|
|
142
|
+
if(!S.bld)return;
|
|
143
|
+
var c=cizelge(),top=toplam(),el=$('#cizelge'),h='';
|
|
144
|
+
c.forEach(function(s,i){
|
|
145
|
+
var son=i===c.length-1;
|
|
146
|
+
h+='<div class="seg'+(son?' son':'')+'" data-i="'+i+'" style="flex:'+s.sure+' 1 0" title="'+esc(s.ad)+' · '+s.sure.toFixed(1)+' sn">'+esc(s.ad)+' · '+s.sure.toFixed(1)+' sn</div>';
|
|
147
|
+
h+='<button class="tutamac" data-i="'+i+'" '+(yazabilir()?'':'disabled ')+'aria-label="'+esc(s.ad)+' süresi: '+s.sure.toFixed(1)+' saniye. Ok tuşlarıyla değiştirin" role="slider" aria-valuemin="0.5" aria-valuemax="120" aria-valuenow="'+s.sure+'"></button>';
|
|
148
|
+
});
|
|
149
|
+
h+='<div id="imlec" style="left:'+(top?S.t/top*100:0)+'%"></div>';
|
|
150
|
+
S.yorumlar.forEach(function(y){if(typeof y.an!=='number'||!top)return;h+='<button class="pin'+(y.durum==='cozuldu'?' cozuldu':'')+'" style="left:'+(y.an/top*100)+'%" data-an="'+y.an+'" title="'+esc(sn(y.an)+' · '+y.metin)+'" aria-label="'+esc('Yorum '+sn(y.an))+'"></button>'});
|
|
151
|
+
el.innerHTML=h;
|
|
152
|
+
[].forEach.call(el.querySelectorAll('.pin'),function(p){p.onclick=function(e){e.stopPropagation();durdur();git(+p.dataset.an)}});
|
|
153
|
+
[].forEach.call(el.querySelectorAll('.seg'),function(sg){sg.onclick=function(e){if(S.surukle)return;durdur();var r=el.getBoundingClientRect();git((e.clientX-r.left)/r.width*toplam())}});
|
|
154
|
+
[].forEach.call(el.querySelectorAll('.tutamac'),function(tm){
|
|
155
|
+
tm.onpointerdown=function(e){
|
|
156
|
+
if(!yazabilir())return;e.preventDefault();tm.setPointerCapture(e.pointerId);
|
|
157
|
+
var i=+tm.dataset.i,r=el.getBoundingClientRect();
|
|
158
|
+
S.surukle={i:i,x0:e.clientX,sure0:cizelge()[i].sure,pxSn:r.width/toplam(),yeni:cizelge()[i].sure};
|
|
159
|
+
};
|
|
160
|
+
tm.onpointermove=function(e){
|
|
161
|
+
if(!S.surukle||S.surukle.i!==+tm.dataset.i)return;
|
|
162
|
+
var y=Math.round((S.surukle.sure0+(e.clientX-S.surukle.x0)/S.surukle.pxSn)*10)/10;
|
|
163
|
+
y=Math.min(120,Math.max(0.5,y));S.surukle.yeni=y;
|
|
164
|
+
var segs=el.querySelectorAll('.seg');segs[S.surukle.i].style.flex=y+' 1 0';segs[S.surukle.i].textContent=cizelge()[S.surukle.i].ad+' · '+y.toFixed(1)+' sn';
|
|
165
|
+
};
|
|
166
|
+
tm.onpointerup=function(e){
|
|
167
|
+
if(!S.surukle)return;var s=S.surukle;S.surukle=null;
|
|
168
|
+
try{tm.releasePointerCapture(e.pointerId)}catch(x){}
|
|
169
|
+
sureKaydet(cizelge()[s.i].id,s.yeni);
|
|
170
|
+
};
|
|
171
|
+
tm.onkeydown=function(e){
|
|
172
|
+
var d=e.key==='ArrowRight'||e.key==='ArrowUp'?1:(e.key==='ArrowLeft'||e.key==='ArrowDown'?-1:0);
|
|
173
|
+
if(!d||!yazabilir())return;e.preventDefault();
|
|
174
|
+
var i=+tm.dataset.i,c0=cizelge()[i];sureKaydet(c0.id,Math.round((c0.sure+d*(e.shiftKey?1:0.1))*10)/10);
|
|
175
|
+
};
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
function sureKaydet(id,sure){
|
|
179
|
+
return api('film-sure',{id:id,sure:sure}).then(function(r){T.sureDegisimi++;S.bld=r.bildirim;cizelgeCiz();git(S.t,true);haber('Süre kaydedildi')}).catch(function(e){haber(e.message);return yukle()});
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/* ---- metni yerinde duzelt: cift tikla; kayit KAYNAK dosyadaki ogeye uygulanir (seek'in ani stilleri dosyaya yazilmaz) ---- */
|
|
183
|
+
function baglaDuzenle(f,a){
|
|
184
|
+
var d;try{d=f.contentDocument}catch(e){return}
|
|
185
|
+
if(!d)return;
|
|
186
|
+
d.addEventListener('click',function(e){
|
|
187
|
+
var el=e.target;while(el&&el.nodeType===1&&!el.getAttribute('data-tuval-id'))el=el.parentElement;
|
|
188
|
+
var r=(e.target.getBoundingClientRect?e.target.getBoundingClientRect():{left:0,top:0,width:0,height:0});
|
|
189
|
+
S.sonSecim=el&&el.nodeType===1?{artboard:a.id,css:'[data-tuval-id="'+el.getAttribute('data-tuval-id')+'"]',metin:norm(el.textContent).slice(0,200),kutu:{x:Math.round(r.left),y:Math.round(r.top),g:Math.round(r.width),y2:Math.round(r.height)}}:null;
|
|
190
|
+
$('#secim').textContent=S.sonSecim?'Seçili öğe: '+(S.sonSecim.metin.slice(0,40)||S.sonSecim.css):'';
|
|
191
|
+
},true);
|
|
192
|
+
d.addEventListener('dblclick',function(e){
|
|
193
|
+
if(!yazabilir())return;
|
|
194
|
+
var el=e.target;while(el&&el.nodeType===1&&!el.getAttribute('data-tuval-id'))el=el.parentElement;
|
|
195
|
+
if(!el||el.nodeType!==1||!norm(el.textContent))return;
|
|
196
|
+
durdur();e.preventDefault();
|
|
197
|
+
var id=el.getAttribute('data-tuval-id'),once=el.textContent;
|
|
198
|
+
S.duzenleniyor=true;el.setAttribute('contenteditable','true');el.focus();
|
|
199
|
+
var bitir=function(iptal){
|
|
200
|
+
el.removeEventListener('blur',kapat);el.removeEventListener('keydown',tus);
|
|
201
|
+
el.removeAttribute('contenteditable');S.duzenleniyor=false;
|
|
202
|
+
var yeni=el.textContent;
|
|
203
|
+
if(iptal||yeni===once){el.textContent=once;return}
|
|
204
|
+
metinKaydet(a.id,id,once,yeni);
|
|
205
|
+
};
|
|
206
|
+
var kapat=function(){bitir(false)};
|
|
207
|
+
var tus=function(ev){if(ev.key==='Escape'){bitir(true)}else if(ev.key==='Enter'&&!ev.shiftKey){ev.preventDefault();el.blur()}};
|
|
208
|
+
el.addEventListener('blur',kapat);el.addEventListener('keydown',tus);
|
|
209
|
+
},true);
|
|
210
|
+
}
|
|
211
|
+
function metinKaydet(artId,kimlik,eski,yeni){
|
|
212
|
+
return fetch(M+'a/'+encodeURIComponent(artId)+'?ham=1&t='+Date.now()).then(function(r){return r.text()}).then(function(kaynak){
|
|
213
|
+
var doc=new DOMParser().parseFromString(kaynak,'text/html');
|
|
214
|
+
var el=doc.querySelector('[data-tuval-id="'+kimlik+'"]');
|
|
215
|
+
if(!el)throw new Error('Öğe kaynak dosyada bulunamadı');
|
|
216
|
+
var dugum=[].filter.call(el.childNodes,function(n){return n.nodeType===3&&n.nodeValue.indexOf(eski)>=0})[0];
|
|
217
|
+
if(el.children.length===0){el.textContent=yeni}
|
|
218
|
+
else if(dugum){dugum.nodeValue=dugum.nodeValue.replace(eski,yeni)}
|
|
219
|
+
else throw new Error('Bu öğenin metni alt öğelerde; alt öğeye çift tıklayın');
|
|
220
|
+
return api('kaydet',{artboard:artId,html:'<!doctype html>\n'+doc.documentElement.outerHTML,taban:S.hashler[artId]});
|
|
221
|
+
}).then(function(r){
|
|
222
|
+
T.kayitlar++;
|
|
223
|
+
if(r.durum==='catisma'){haber('Başkası aynı yeri değiştirdi; seçenekler için tasarım düzenleyicisini açın');return}
|
|
224
|
+
haber(r.durum==='birlesti'?'Kaydedildi (başkasının değişikliğiyle birleştirildi)':'Kaydedildi');
|
|
225
|
+
}).catch(function(e){haber('Kaydedilemedi: '+e.message)}).then(function(){sahneAnahtar='';return yukle()});
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/* ---- yorumlar ---- */
|
|
229
|
+
var DURUM={acik:'Taslak',gonderildi:'Sera’ya gönderildi',alindi:'Sera üzerinde çalışıyor',cozuldu:'Çözüldü'};
|
|
230
|
+
function yorumCiz(){
|
|
231
|
+
var p=$('#panel'),h='<h2>Yorumlar ('+S.yorumlar.length+')</h2>';
|
|
232
|
+
if(!S.yorumlar.length)h+='<div class="bos">Henüz yorum yok. Filmi istediğiniz ana getirin, notunuzu yazın.</div>';
|
|
233
|
+
S.yorumlar.slice().sort(function(a,b){return (a.an||0)-(b.an||0)}).forEach(function(y){
|
|
234
|
+
h+='<div class="kart"><div class="ust"><button class="an" data-an="'+(y.an||0)+'">'+sn(y.an||0)+'</button><span>'+esc(y.artboard)+'</span>'+(y.ad?'<span>'+esc(y.ad)+'</span>':'')+'<span class="bosluk"></span><span class="rozet">'+DURUM[y.durum]+'</span></div><div>'+esc(y.metin)+'</div>';
|
|
235
|
+
y.yanitlar.forEach(function(r){h+='<div class="yanit"><b>'+(r.yazar==='sera'?'Sera':'Siz')+':</b> '+esc(r.metin)+'</div>'});
|
|
236
|
+
h+='</div>';
|
|
237
|
+
});
|
|
238
|
+
p.innerHTML=h;
|
|
239
|
+
[].forEach.call(p.querySelectorAll('.an'),function(b){b.onclick=function(){durdur();git(+b.dataset.an)}});
|
|
240
|
+
var acik=S.yorumlar.filter(function(y){return y.durum==='acik'}).length;
|
|
241
|
+
var g=$('#gonder');g.disabled=!acik;g.textContent='Sera’ya gönder'+(acik?' ('+acik+')':'');
|
|
242
|
+
}
|
|
243
|
+
function adim(){try{return sessionStorage.getItem('tuval_ad')||''}catch(e){return ''}}
|
|
244
|
+
function yorumEkle(){
|
|
245
|
+
var ta=$('#yorum-metin'),m=ta.value.trim();if(!m){ta.focus();return}
|
|
246
|
+
var s=sahneBul(S.t),sc=S.sonSecim&&S.sonSecim.artboard===s.c.id?S.sonSecim:{css:'body',metin:'',kutu:{x:0,y:0,g:0,y2:0}};
|
|
247
|
+
api('yorum',{artboard:s.c.id,secici:sc,metin:m,zaman:S.t,ad:adim()}).then(function(){ta.value='';haber('Yorum bu ana eklendi: '+sn(S.t));return yukle()}).catch(function(e){haber(e.message)});
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function basla(){
|
|
251
|
+
$('#oynat').onclick=function(){S.oynuyor?durdur():oynat()};
|
|
252
|
+
$('#basa').onclick=function(){durdur();git(0)};
|
|
253
|
+
$('#yorum-ekle').onclick=yorumEkle;
|
|
254
|
+
$('#yorum-metin').addEventListener('keydown',function(e){if(e.key==='Enter'&&(e.ctrlKey||e.metaKey))yorumEkle()});
|
|
255
|
+
$('#gonder').onclick=function(){api('gonder',{}).then(function(r){haber(r.gonderilen+' yorum Sera’ya gönderildi');return yukle()}).catch(function(e){haber(e.message)})};
|
|
256
|
+
$('#editor').onclick=function(){location.href=M+'?editor=1'};
|
|
257
|
+
document.addEventListener('keydown',function(e){
|
|
258
|
+
if(e.target&&/INPUT|TEXTAREA/.test(e.target.tagName))return;
|
|
259
|
+
if(e.code==='Space'){e.preventDefault();S.oynuyor?durdur():oynat()}
|
|
260
|
+
if(e.key==='ArrowRight'){durdur();git(S.t+0.5)}
|
|
261
|
+
if(e.key==='ArrowLeft'){durdur();git(S.t-0.5)}
|
|
262
|
+
});
|
|
263
|
+
yukle().then(function(){
|
|
264
|
+
var es=new EventSource(M+'olaylar');
|
|
265
|
+
es.onmessage=function(m){
|
|
266
|
+
var o=JSON.parse(m.data);
|
|
267
|
+
if(o.tur==='degisti'){if(S.duzenleniyor||S.surukle)return;T.yenileme++;sahneAnahtar='';yukle()}
|
|
268
|
+
};
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
basla();
|
|
272
|
+
})();
|
|
273
|
+
`;
|
|
274
|
+
|
|
275
|
+
export function filmHtml(): string {
|
|
276
|
+
return `<!doctype html>
|
|
277
|
+
<html lang="tr"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
|
278
|
+
<title>Sera Tuval Film</title><style>${TEMEL_CSS}${CSS}</style></head>
|
|
279
|
+
<body>
|
|
280
|
+
<div id="kabuk">
|
|
281
|
+
<header>
|
|
282
|
+
<h1 id="ad">Film</h1>
|
|
283
|
+
<button id="basa" aria-label="Başa sar">⏮</button>
|
|
284
|
+
<button id="oynat" class="birincil" aria-pressed="false">Oynat</button>
|
|
285
|
+
<span id="zaman" aria-live="off">0:00.0 / 0:00.0</span>
|
|
286
|
+
<span id="rol-not" style="color:var(--soluk);font-size:12px"></span>
|
|
287
|
+
<span class="bosluk"></span>
|
|
288
|
+
<button id="gonder" class="birincil" disabled>Sera’ya gönder</button>
|
|
289
|
+
<button id="editor">Sayfa düzenleyici</button>
|
|
290
|
+
</header>
|
|
291
|
+
<div id="govde">
|
|
292
|
+
<main id="orta" aria-label="Film">
|
|
293
|
+
<div id="sahne" role="img" aria-label="Film sahnesi"></div>
|
|
294
|
+
<div id="altyazi" aria-live="polite"></div>
|
|
295
|
+
<div id="cizelge" aria-label="Zaman çizelgesi"></div>
|
|
296
|
+
<div id="secim" style="color:var(--soluk);font-size:12px;min-height:16px"></div>
|
|
297
|
+
<div id="yorum-form"><textarea id="yorum-metin" rows="2" placeholder="Bu ana bir not yazın (örn. yazı çok çabuk kayboluyor)" aria-label="Bu ana yorum"></textarea><button id="yorum-ekle" class="birincil">Bu ana yorum bırak</button></div>
|
|
298
|
+
<div class="bos">Boşluk: oynat/duraklat · ok tuşları: yarım saniye · yazıya çift tıklayarak yerinde düzeltin · çizelgedeki tutamaçları sürükleyerek sahne süresini değiştirin.</div>
|
|
299
|
+
</main>
|
|
300
|
+
<aside id="panel" aria-label="Yorumlar"></aside>
|
|
301
|
+
</div>
|
|
302
|
+
</div>
|
|
303
|
+
<audio id="ses" preload="auto" src="ses"></audio>
|
|
304
|
+
<div id="bildirim" role="status"></div>
|
|
305
|
+
<script>${JS.replace("SEEK_KOD", () => JSON.stringify(FILM_SEEK_JS))}</script>
|
|
306
|
+
</body></html>`;
|
|
307
|
+
}
|