clawmini 0.0.3 → 0.0.5
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.md +19 -0
- package/dist/adapter-discord/index.d.mts.map +1 -1
- package/dist/adapter-discord/index.mjs +398 -193
- package/dist/adapter-discord/index.mjs.map +1 -1
- package/dist/adapter-google-chat/index.d.mts +5 -0
- package/dist/adapter-google-chat/index.d.mts.map +1 -0
- package/dist/adapter-google-chat/index.mjs +1077 -0
- package/dist/adapter-google-chat/index.mjs.map +1 -0
- package/dist/cli/index.mjs +107 -14
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lite.mjs +175 -16
- package/dist/cli/lite.mjs.map +1 -1
- package/dist/cli/propose-policy.d.mts +1 -0
- package/dist/cli/propose-policy.mjs +7159 -0
- package/dist/cli/propose-policy.mjs.map +1 -0
- package/dist/daemon/index.d.mts.map +1 -1
- package/dist/daemon/index.mjs +1427 -513
- package/dist/daemon/index.mjs.map +1 -1
- package/dist/{lite-oSYSvaOr.mjs → lite-CBxOT1y5.mjs} +101 -24
- package/dist/lite-CBxOT1y5.mjs.map +1 -0
- package/dist/routing-D8rTxtaV.mjs +245 -0
- package/dist/routing-D8rTxtaV.mjs.map +1 -0
- package/dist/web/_app/immutable/assets/0.C-4eziNy.css +1 -0
- package/dist/web/_app/immutable/assets/4.Cc_xwLNl.css +1 -0
- package/dist/web/_app/immutable/chunks/B6YN0Nuq.js +1 -0
- package/dist/web/_app/immutable/chunks/{Dc-UOHw9.js → BmRlVmv6.js} +1 -1
- package/{web/.svelte-kit/output/client/_app/immutable/chunks/8YNcRyEk.js → dist/web/_app/immutable/chunks/C20lZMGz.js} +1 -1
- package/dist/web/_app/immutable/chunks/C9lbZ-kT.js +1 -0
- package/dist/web/_app/immutable/chunks/CK9JZLaG.js +2 -0
- package/dist/web/_app/immutable/chunks/CME08kGM.js +1 -0
- package/dist/web/_app/immutable/chunks/{BPy8HLo7.js → Ck-be5J2.js} +1 -1
- package/dist/web/_app/immutable/chunks/Ck3rYNON.js +1 -0
- package/dist/web/_app/immutable/chunks/DMtIqaiV.js +2 -0
- package/dist/web/_app/immutable/chunks/{B8yYFADm.js → DhD271EB.js} +1 -1
- package/dist/web/_app/immutable/chunks/{DcrmIfTj.js → DpuLqk8d.js} +1 -1
- package/dist/web/_app/immutable/chunks/{ZkLyk0mE.js → Drm9vgeP.js} +1 -1
- package/dist/web/_app/immutable/chunks/DsIToJCP.js +1 -0
- package/dist/web/_app/immutable/chunks/{CyNaE55B.js → Zeh-C-mx.js} +1 -1
- package/{web/.svelte-kit/output/client/_app/immutable/entry/app.DO5eYwVz.js → dist/web/_app/immutable/entry/app.BgB5VkRU.js} +2 -2
- package/dist/web/_app/immutable/entry/start.DuxJo6av.js +1 -0
- package/dist/web/_app/immutable/nodes/0.C9oFZP9h.js +1 -0
- package/dist/web/_app/immutable/nodes/1.BON2Wk6k.js +1 -0
- package/dist/web/_app/immutable/nodes/{2.CK3CLC0f.js → 2.BnwnD1Ki.js} +1 -1
- package/dist/web/_app/immutable/nodes/{3.ncP0xLO6.js → 3.CIs4tjjw.js} +1 -1
- package/dist/web/_app/immutable/nodes/4.DLarELN4.js +60 -0
- package/dist/web/_app/immutable/nodes/{5.BpJUN6QH.js → 5.CE_QKy_3.js} +1 -1
- package/dist/web/_app/version.json +1 -1
- package/dist/web/index.html +12 -12
- package/dist/{workspace-DjoNjhW0.mjs → workspace-BJmJBfKi.mjs} +103 -11
- package/dist/workspace-BJmJBfKi.mjs.map +1 -0
- package/docs/14_google_chat_adapter/development_log.md +40 -0
- package/docs/14_google_chat_adapter/notes.md +28 -0
- package/docs/14_google_chat_adapter/prd.md +35 -0
- package/docs/14_google_chat_adapter/questions.md +9 -0
- package/docs/14_google_chat_adapter/tickets.md +117 -0
- package/docs/15_sandbox_policies/tickets.md +33 -0
- package/docs/16_session_timeout/development_log.md +20 -0
- package/docs/16_session_timeout/notes.md +44 -0
- package/docs/16_session_timeout/prd.md +106 -0
- package/docs/16_session_timeout/questions.md +10 -0
- package/docs/16_session_timeout/tickets.md +64 -0
- package/docs/17_auto_approve_policy/development_log.md +29 -0
- package/docs/17_auto_approve_policy/notes.md +25 -0
- package/docs/17_auto_approve_policy/prd.md +34 -0
- package/docs/17_auto_approve_policy/questions.md +10 -0
- package/docs/17_auto_approve_policy/tickets.md +11 -0
- package/docs/18_clawmini_skills/development_log.md +36 -0
- package/docs/18_clawmini_skills/notes.md +8 -0
- package/docs/18_clawmini_skills/prd.md +45 -0
- package/docs/18_clawmini_skills/questions.md +10 -0
- package/docs/18_clawmini_skills/tickets.md +55 -0
- package/docs/19_subagents/development_log.md +69 -0
- package/docs/19_subagents/notes.md +18 -0
- package/docs/19_subagents/prd.md +156 -0
- package/docs/19_subagents/questions.md +13 -0
- package/docs/19_subagents/tickets.md +113 -0
- package/docs/20_chat_logs_cleanup/development_log.md +50 -0
- package/docs/20_chat_logs_cleanup/notes.md +43 -0
- package/docs/20_chat_logs_cleanup/prd.md +232 -0
- package/docs/20_chat_logs_cleanup/questions.md +2 -0
- package/docs/20_chat_logs_cleanup/tickets.md +98 -0
- package/docs/20_webui_markdown/development_log.md +36 -0
- package/docs/20_webui_markdown/notes.md +23 -0
- package/docs/20_webui_markdown/prd.md +49 -0
- package/docs/20_webui_markdown/questions.md +10 -0
- package/docs/20_webui_markdown/tickets.md +55 -0
- package/docs/21_adapter_filtering/development_log.md +29 -0
- package/docs/21_adapter_filtering/notes.md +25 -0
- package/docs/21_adapter_filtering/prd.md +44 -0
- package/docs/21_adapter_filtering/questions.md +12 -0
- package/docs/21_adapter_filtering/tickets.md +38 -0
- package/docs/21_built_in_routers/development_log.md +17 -0
- package/docs/21_built_in_routers/notes.md +27 -0
- package/docs/21_built_in_routers/prd.md +34 -0
- package/docs/21_built_in_routers/questions.md +4 -0
- package/docs/21_built_in_routers/tickets.md +25 -0
- package/docs/21_fancy_policies/development_log.md +38 -0
- package/docs/21_fancy_policies/notes.md +27 -0
- package/docs/21_fancy_policies/prd.md +58 -0
- package/docs/21_fancy_policies/questions.md +6 -0
- package/docs/21_fancy_policies/tickets.md +48 -0
- package/docs/22_adapter_multi_chat/development_log.md +76 -0
- package/docs/22_adapter_multi_chat/notes.md +42 -0
- package/docs/22_adapter_multi_chat/prd.md +76 -0
- package/docs/22_adapter_multi_chat/questions.md +16 -0
- package/docs/22_adapter_multi_chat/tickets.md +164 -0
- package/docs/23_custom_token_env/development_log.md +31 -0
- package/docs/23_custom_token_env/notes.md +16 -0
- package/docs/23_custom_token_env/prd.md +42 -0
- package/docs/23_custom_token_env/questions.md +8 -0
- package/docs/23_custom_token_env/tickets.md +54 -0
- package/docs/guides/discord_adapter_setup.md +15 -2
- package/docs/guides/google_chat_adapter_setup.md +145 -0
- package/napkin.md +5 -0
- package/package.json +7 -2
- package/src/adapter-discord/config.test.ts +27 -8
- package/src/adapter-discord/config.ts +6 -8
- package/src/adapter-discord/forwarder.test.ts +307 -114
- package/src/adapter-discord/forwarder.ts +260 -75
- package/src/adapter-discord/index.test.ts +278 -0
- package/src/adapter-discord/index.ts +160 -30
- package/src/adapter-discord/interactions.test.ts +96 -0
- package/src/adapter-discord/interactions.ts +156 -0
- package/src/adapter-discord/state.test.ts +9 -8
- package/src/adapter-discord/state.ts +51 -8
- package/src/adapter-google-chat/auth.test.ts +87 -0
- package/src/adapter-google-chat/auth.ts +132 -0
- package/src/adapter-google-chat/cards.ts +71 -0
- package/src/adapter-google-chat/client.test.ts +561 -0
- package/src/adapter-google-chat/client.ts +430 -0
- package/src/adapter-google-chat/config.test.ts +187 -0
- package/src/adapter-google-chat/config.ts +82 -0
- package/src/adapter-google-chat/cron.test.ts +143 -0
- package/src/adapter-google-chat/cron.ts +81 -0
- package/src/adapter-google-chat/forwarder.test.ts +537 -0
- package/src/adapter-google-chat/forwarder.ts +349 -0
- package/src/adapter-google-chat/index.test.ts +62 -0
- package/src/adapter-google-chat/index.ts +61 -0
- package/src/adapter-google-chat/state.test.ts +96 -0
- package/src/adapter-google-chat/state.ts +85 -0
- package/src/adapter-google-chat/subscriptions.ts +124 -0
- package/src/adapter-google-chat/upload.ts +88 -0
- package/src/adapter-google-chat/utils.test.ts +111 -0
- package/src/adapter-google-chat/utils.ts +133 -0
- package/src/cli/commands/init.ts +0 -7
- package/src/cli/commands/messages.ts +18 -3
- package/src/cli/commands/policies.ts +70 -0
- package/src/cli/commands/skills.ts +71 -0
- package/src/cli/commands/web-api/chats.ts +5 -1
- package/src/cli/e2e/basic.test.ts +1 -1
- package/src/cli/e2e/cron.test.ts +1 -1
- package/src/cli/e2e/daemon.test.ts +132 -4
- package/src/cli/e2e/export-lite-func.test.ts +54 -31
- package/src/cli/e2e/fallbacks.test.ts +8 -6
- package/src/cli/e2e/init.test.ts +7 -0
- package/src/cli/e2e/messages.test.ts +90 -55
- package/src/cli/e2e/propose-policy.test.ts +203 -0
- package/src/cli/e2e/requests.test.ts +15 -0
- package/src/cli/e2e/session-timeout.test.ts +192 -0
- package/src/cli/e2e/skills.test.ts +55 -0
- package/src/cli/e2e/slash-new.test.ts +93 -0
- package/src/cli/e2e/subagents.test.ts +106 -0
- package/src/cli/index.ts +4 -0
- package/src/cli/lite.ts +51 -11
- package/src/cli/propose-policy.ts +91 -0
- package/src/cli/subagent-commands.ts +215 -0
- package/src/daemon/agent/agent-context.ts +89 -0
- package/src/daemon/agent/agent-extractors.ts +68 -0
- package/src/daemon/agent/agent-runner.ts +153 -0
- package/src/daemon/agent/agent-session.ts +261 -0
- package/src/daemon/agent/chat-logger.test.ts +158 -0
- package/src/daemon/agent/chat-logger.ts +188 -0
- package/src/daemon/agent/task-scheduler.test.ts +202 -0
- package/src/daemon/agent/task-scheduler.ts +276 -0
- package/src/daemon/agent/types.ts +84 -0
- package/src/daemon/agent/utils.ts +7 -0
- package/src/daemon/api/agent-router.ts +166 -18
- package/src/daemon/api/index.test.ts +50 -18
- package/src/daemon/api/policy-request.test.ts +39 -2
- package/src/daemon/api/subagent-router.test.ts +108 -0
- package/src/daemon/api/subagent-router.ts +296 -0
- package/src/daemon/api/subagent-utils.test.ts +56 -0
- package/src/daemon/api/subagent-utils.ts +130 -0
- package/src/daemon/api/user-router.ts +30 -13
- package/src/daemon/auth.ts +1 -0
- package/src/daemon/chats.ts +6 -0
- package/src/daemon/cron.test.ts +66 -1
- package/src/daemon/cron.ts +35 -8
- package/src/daemon/index.ts +23 -0
- package/src/daemon/message-agent.test.ts +11 -25
- package/src/daemon/message-extraction.test.ts +10 -27
- package/src/daemon/message-fallbacks.test.ts +13 -35
- package/src/daemon/message-interruption.test.ts +70 -53
- package/src/daemon/message-jobs.test.ts +138 -0
- package/src/daemon/message-queue.test.ts +30 -43
- package/src/daemon/message-router.test.ts +12 -11
- package/src/daemon/message-session.test.ts +41 -28
- package/src/daemon/message-typing.test.ts +19 -6
- package/src/daemon/message.ts +103 -515
- package/src/daemon/policy-request-service.ts +8 -3
- package/src/daemon/policy-utils.ts +19 -1
- package/src/daemon/queue.ts +16 -0
- package/src/daemon/request-store.test.ts +4 -0
- package/src/daemon/routers/session-timeout.test.ts +122 -0
- package/src/daemon/routers/session-timeout.ts +71 -0
- package/src/daemon/routers/slash-new.ts +3 -1
- package/src/daemon/routers/slash-policies.test.ts +26 -13
- package/src/daemon/routers/slash-policies.ts +39 -29
- package/src/daemon/routers/types.ts +8 -0
- package/src/daemon/routers.ts +64 -2
- package/src/daemon/utils/spawn.ts +6 -8
- package/src/shared/adapters/commands.test.ts +155 -0
- package/src/shared/adapters/commands.ts +125 -0
- package/src/shared/adapters/filtering.test.ts +111 -0
- package/src/shared/adapters/filtering.ts +57 -0
- package/src/shared/adapters/routing.test.ts +144 -0
- package/src/shared/adapters/routing.ts +109 -0
- package/src/shared/agent-utils.ts +10 -0
- package/src/shared/chats.test.ts +145 -3
- package/src/shared/chats.ts +215 -18
- package/src/shared/config.ts +67 -15
- package/src/shared/lite.ts +22 -18
- package/src/shared/policies.ts +7 -0
- package/src/shared/workspace.test.ts +45 -1
- package/src/shared/workspace.ts +119 -6
- package/templates/debug/settings.json +5 -2
- package/templates/environments/cladding/env.json +2 -2
- package/templates/gemini/.gemini/hooks/check-subagents.mjs +23 -0
- package/templates/gemini/.gemini/hooks/clawmini-logging.sh +17 -0
- package/templates/gemini/.gemini/hooks/insert-pending.sh +9 -0
- package/templates/gemini/.gemini/settings.json +50 -0
- package/templates/gemini/settings.json +22 -8
- package/templates/gemini-claw/.gemini/base-system.md +100 -0
- package/templates/gemini-claw/.gemini/hooks/check-subagents.mjs +23 -0
- package/templates/gemini-claw/.gemini/hooks/clawmini-logging.sh +1 -1
- package/templates/gemini-claw/.gemini/settings.json +13 -0
- package/templates/gemini-claw/.gemini/subagent-system.md +7 -0
- package/templates/gemini-claw/.gemini/system.md +3 -99
- package/templates/gemini-claw/settings.json +27 -22
- package/templates/skills/clawmini-requests/SKILL.md +92 -0
- package/templates/skills/clawmini-subagents/SKILL.md +79 -0
- package/templates/skills/skill-creator/SKILL.md +60 -0
- package/tsdown.config.ts +10 -1
- package/web/.svelte-kit/generated/server/internal.js +2 -1
- package/web/.svelte-kit/non-ambient.d.ts +2 -0
- package/web/.svelte-kit/output/client/.vite/manifest.json +141 -138
- package/web/.svelte-kit/output/client/_app/immutable/assets/0.C-4eziNy.css +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/assets/4.Cc_xwLNl.css +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/B6YN0Nuq.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/{Dc-UOHw9.js → BmRlVmv6.js} +1 -1
- package/{dist/web/_app/immutable/chunks/8YNcRyEk.js → web/.svelte-kit/output/client/_app/immutable/chunks/C20lZMGz.js} +1 -1
- package/web/.svelte-kit/output/client/_app/immutable/chunks/C9lbZ-kT.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/CK9JZLaG.js +2 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/CME08kGM.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/{BPy8HLo7.js → Ck-be5J2.js} +1 -1
- package/web/.svelte-kit/output/client/_app/immutable/chunks/Ck3rYNON.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/DMtIqaiV.js +2 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/{B8yYFADm.js → DhD271EB.js} +1 -1
- package/web/.svelte-kit/output/client/_app/immutable/chunks/{DcrmIfTj.js → DpuLqk8d.js} +1 -1
- package/web/.svelte-kit/output/client/_app/immutable/chunks/{ZkLyk0mE.js → Drm9vgeP.js} +1 -1
- package/web/.svelte-kit/output/client/_app/immutable/chunks/DsIToJCP.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/{CyNaE55B.js → Zeh-C-mx.js} +1 -1
- package/{dist/web/_app/immutable/entry/app.DO5eYwVz.js → web/.svelte-kit/output/client/_app/immutable/entry/app.BgB5VkRU.js} +2 -2
- package/web/.svelte-kit/output/client/_app/immutable/entry/start.DuxJo6av.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/nodes/0.C9oFZP9h.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/nodes/1.BON2Wk6k.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/nodes/{2.CK3CLC0f.js → 2.BnwnD1Ki.js} +1 -1
- package/web/.svelte-kit/output/client/_app/immutable/nodes/{3.ncP0xLO6.js → 3.CIs4tjjw.js} +1 -1
- package/web/.svelte-kit/output/client/_app/immutable/nodes/4.DLarELN4.js +60 -0
- package/web/.svelte-kit/output/client/_app/immutable/nodes/{5.BpJUN6QH.js → 5.CE_QKy_3.js} +1 -1
- package/web/.svelte-kit/output/client/_app/version.json +1 -1
- package/web/.svelte-kit/output/server/.vite/manifest.json +12 -3
- package/web/.svelte-kit/output/server/_app/immutable/assets/_layout.C-4eziNy.css +1 -0
- package/web/.svelte-kit/output/server/_app/immutable/assets/_page.Cc_xwLNl.css +1 -0
- package/web/.svelte-kit/output/server/chunks/app-state.svelte.js +5 -0
- package/web/.svelte-kit/output/server/chunks/bot.js +4 -4
- package/web/.svelte-kit/output/server/chunks/client.js +2 -1
- package/web/.svelte-kit/output/server/chunks/exports.js +0 -1
- package/web/.svelte-kit/output/server/chunks/internal.js +2 -1
- package/web/.svelte-kit/output/server/chunks/root.js +482 -392
- package/web/.svelte-kit/output/server/entries/pages/_layout.svelte.js +57 -7
- package/web/.svelte-kit/output/server/entries/pages/chats/_id_/_page.svelte.js +234 -9
- package/web/.svelte-kit/output/server/index.js +82 -10
- package/web/.svelte-kit/output/server/manifest-full.js +1 -1
- package/web/.svelte-kit/output/server/manifest.js +1 -1
- package/web/.svelte-kit/output/server/nodes/0.js +2 -2
- package/web/.svelte-kit/output/server/nodes/1.js +1 -1
- package/web/.svelte-kit/output/server/nodes/2.js +1 -1
- package/web/.svelte-kit/output/server/nodes/3.js +1 -1
- package/web/.svelte-kit/output/server/nodes/4.js +2 -2
- package/web/.svelte-kit/output/server/nodes/5.js +1 -1
- package/web/.svelte-kit/types/src/routes/$types.d.ts +1 -2
- package/web/.svelte-kit/types/src/routes/agents/$types.d.ts +1 -2
- package/web/.svelte-kit/types/src/routes/chats/[id]/$types.d.ts +1 -2
- package/web/.svelte-kit/types/src/routes/chats/[id]/settings/$types.d.ts +1 -2
- package/web/package.json +8 -0
- package/web/src/lib/app-state.svelte.ts +5 -1
- package/web/src/lib/components/app/markdown-renderer.svelte +56 -0
- package/web/src/lib/components/app/markdown-renderer.svelte.spec.ts +44 -0
- package/web/src/lib/components/app/message-content.svelte +16 -0
- package/web/src/lib/types.ts +67 -3
- package/web/src/routes/+layout.svelte +31 -1
- package/web/src/routes/chats/[id]/+page.svelte +167 -18
- package/web/src/routes/chats/[id]/page.svelte.spec.ts +58 -7
- package/dist/lite-oSYSvaOr.mjs.map +0 -1
- package/dist/web/_app/immutable/assets/0.GI4C4dpV.css +0 -1
- package/dist/web/_app/immutable/chunks/B5abRDXp.js +0 -1
- package/dist/web/_app/immutable/chunks/Bi0jeV7Q.js +0 -1
- package/dist/web/_app/immutable/chunks/BmUXQ3wy.js +0 -2
- package/dist/web/_app/immutable/chunks/C3k55nDF.js +0 -1
- package/dist/web/_app/immutable/chunks/CpaGRn9L.js +0 -1
- package/dist/web/_app/immutable/chunks/DG5RZBw-.js +0 -2
- package/dist/web/_app/immutable/chunks/DQoygso7.js +0 -1
- package/dist/web/_app/immutable/entry/start.D48mVn1m.js +0 -1
- package/dist/web/_app/immutable/nodes/0.B-0CcADM.js +0 -1
- package/dist/web/_app/immutable/nodes/1.FixKgvRO.js +0 -1
- package/dist/web/_app/immutable/nodes/4.CQYJEgv8.js +0 -1
- package/dist/workspace-DjoNjhW0.mjs.map +0 -1
- package/src/daemon/message-verbosity.test.ts +0 -127
- package/web/.svelte-kit/output/client/_app/immutable/assets/0.GI4C4dpV.css +0 -1
- package/web/.svelte-kit/output/client/_app/immutable/chunks/B5abRDXp.js +0 -1
- package/web/.svelte-kit/output/client/_app/immutable/chunks/Bi0jeV7Q.js +0 -1
- package/web/.svelte-kit/output/client/_app/immutable/chunks/BmUXQ3wy.js +0 -2
- package/web/.svelte-kit/output/client/_app/immutable/chunks/C3k55nDF.js +0 -1
- package/web/.svelte-kit/output/client/_app/immutable/chunks/CpaGRn9L.js +0 -1
- package/web/.svelte-kit/output/client/_app/immutable/chunks/DG5RZBw-.js +0 -2
- package/web/.svelte-kit/output/client/_app/immutable/chunks/DQoygso7.js +0 -1
- package/web/.svelte-kit/output/client/_app/immutable/entry/start.D48mVn1m.js +0 -1
- package/web/.svelte-kit/output/client/_app/immutable/nodes/0.B-0CcADM.js +0 -1
- package/web/.svelte-kit/output/client/_app/immutable/nodes/1.FixKgvRO.js +0 -1
- package/web/.svelte-kit/output/client/_app/immutable/nodes/4.CQYJEgv8.js +0 -1
- package/web/.svelte-kit/output/server/_app/immutable/assets/_layout.GI4C4dpV.css +0 -1
- /package/templates/{gemini-claw/.gemini/skills → skills}/clawmini-jobs/SKILL.md +0 -0
|
@@ -64,6 +64,7 @@ const MAYBE_DIRTY = 1 << 12;
|
|
|
64
64
|
const INERT = 1 << 13;
|
|
65
65
|
const DESTROYED = 1 << 14;
|
|
66
66
|
const REACTION_RAN = 1 << 15;
|
|
67
|
+
const DESTROYING = 1 << 25;
|
|
67
68
|
const EFFECT_TRANSPARENT = 1 << 16;
|
|
68
69
|
const EAGER_EFFECT = 1 << 17;
|
|
69
70
|
const HEAD_EFFECT = 1 << 18;
|
|
@@ -199,6 +200,10 @@ function push$1(props, runes = false, fn) {
|
|
|
199
200
|
e: null,
|
|
200
201
|
s: props,
|
|
201
202
|
x: null,
|
|
203
|
+
r: (
|
|
204
|
+
/** @type {Effect} */
|
|
205
|
+
active_effect
|
|
206
|
+
),
|
|
202
207
|
l: null
|
|
203
208
|
};
|
|
204
209
|
}
|
|
@@ -308,24 +313,26 @@ function defer_effect(effect, dirty_effects, maybe_dirty_effects) {
|
|
|
308
313
|
const batches = /* @__PURE__ */ new Set();
|
|
309
314
|
let current_batch = null;
|
|
310
315
|
let batch_values = null;
|
|
311
|
-
let queued_root_effects = [];
|
|
312
316
|
let last_scheduled_effect = null;
|
|
313
317
|
let is_flushing_sync = false;
|
|
318
|
+
let is_processing = false;
|
|
314
319
|
let collected_effects = null;
|
|
320
|
+
let legacy_updates = null;
|
|
321
|
+
var flush_count = 0;
|
|
315
322
|
let uid = 1;
|
|
316
323
|
class Batch {
|
|
317
|
-
// for debugging. TODO remove once async is stable
|
|
318
324
|
id = uid++;
|
|
319
325
|
/**
|
|
320
|
-
* The current values of any
|
|
326
|
+
* The current values of any signals that are updated in this batch.
|
|
327
|
+
* Tuple format: [value, is_derived] (note: is_derived is false for deriveds, too, if they were overridden via assignment)
|
|
321
328
|
* They keys of this map are identical to `this.#previous`
|
|
322
|
-
* @type {Map<
|
|
329
|
+
* @type {Map<Value, [any, boolean]>}
|
|
323
330
|
*/
|
|
324
331
|
current = /* @__PURE__ */ new Map();
|
|
325
332
|
/**
|
|
326
|
-
* The values of any sources that are updated in this batch _before_ those updates took place.
|
|
333
|
+
* The values of any signals (sources and deriveds) that are updated in this batch _before_ those updates took place.
|
|
327
334
|
* They keys of this map are identical to `this.#current`
|
|
328
|
-
* @type {Map<
|
|
335
|
+
* @type {Map<Value, any>}
|
|
329
336
|
*/
|
|
330
337
|
previous = /* @__PURE__ */ new Map();
|
|
331
338
|
/**
|
|
@@ -340,19 +347,26 @@ class Batch {
|
|
|
340
347
|
*/
|
|
341
348
|
#discard_callbacks = /* @__PURE__ */ new Set();
|
|
342
349
|
/**
|
|
343
|
-
*
|
|
350
|
+
* Async effects that are currently in flight
|
|
351
|
+
* @type {Map<Effect, number>}
|
|
344
352
|
*/
|
|
345
|
-
#pending =
|
|
353
|
+
#pending = /* @__PURE__ */ new Map();
|
|
346
354
|
/**
|
|
347
|
-
*
|
|
355
|
+
* Async effects that are currently in flight, _not_ inside a pending boundary
|
|
356
|
+
* @type {Map<Effect, number>}
|
|
348
357
|
*/
|
|
349
|
-
#blocking_pending =
|
|
358
|
+
#blocking_pending = /* @__PURE__ */ new Map();
|
|
350
359
|
/**
|
|
351
360
|
* A deferred that resolves when the batch is committed, used with `settled()`
|
|
352
361
|
* TODO replace with Promise.withResolvers once supported widely enough
|
|
353
362
|
* @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
|
|
354
363
|
*/
|
|
355
364
|
#deferred = null;
|
|
365
|
+
/**
|
|
366
|
+
* The root effects that need to be flushed
|
|
367
|
+
* @type {Effect[]}
|
|
368
|
+
*/
|
|
369
|
+
#roots = [];
|
|
356
370
|
/**
|
|
357
371
|
* Deferred effects (which run after async work has completed) that are DIRTY
|
|
358
372
|
* @type {Set<Effect>}
|
|
@@ -373,8 +387,29 @@ class Batch {
|
|
|
373
387
|
#skipped_branches = /* @__PURE__ */ new Map();
|
|
374
388
|
is_fork = false;
|
|
375
389
|
#decrement_queued = false;
|
|
390
|
+
/** @type {Set<Batch>} */
|
|
391
|
+
#blockers = /* @__PURE__ */ new Set();
|
|
376
392
|
#is_deferred() {
|
|
377
|
-
return this.is_fork || this.#blocking_pending > 0;
|
|
393
|
+
return this.is_fork || this.#blocking_pending.size > 0;
|
|
394
|
+
}
|
|
395
|
+
#is_blocked() {
|
|
396
|
+
for (const batch of this.#blockers) {
|
|
397
|
+
for (const effect of batch.#blocking_pending.keys()) {
|
|
398
|
+
var skipped = false;
|
|
399
|
+
var e = effect;
|
|
400
|
+
while (e.parent !== null) {
|
|
401
|
+
if (this.#skipped_branches.has(e)) {
|
|
402
|
+
skipped = true;
|
|
403
|
+
break;
|
|
404
|
+
}
|
|
405
|
+
e = e.parent;
|
|
406
|
+
}
|
|
407
|
+
if (!skipped) {
|
|
408
|
+
return true;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
return false;
|
|
378
413
|
}
|
|
379
414
|
/**
|
|
380
415
|
* Add an effect to the #skipped_branches map and reset its children
|
|
@@ -396,47 +431,87 @@ class Batch {
|
|
|
396
431
|
this.#skipped_branches.delete(effect);
|
|
397
432
|
for (var e of tracked.d) {
|
|
398
433
|
set_signal_status(e, DIRTY);
|
|
399
|
-
|
|
434
|
+
this.schedule(e);
|
|
400
435
|
}
|
|
401
436
|
for (e of tracked.m) {
|
|
402
437
|
set_signal_status(e, MAYBE_DIRTY);
|
|
403
|
-
|
|
438
|
+
this.schedule(e);
|
|
404
439
|
}
|
|
405
440
|
}
|
|
406
441
|
}
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
442
|
+
#process() {
|
|
443
|
+
if (flush_count++ > 1e3) {
|
|
444
|
+
batches.delete(this);
|
|
445
|
+
infinite_loop_guard();
|
|
446
|
+
}
|
|
447
|
+
if (!this.#is_deferred()) {
|
|
448
|
+
for (const e of this.#dirty_effects) {
|
|
449
|
+
this.#maybe_dirty_effects.delete(e);
|
|
450
|
+
set_signal_status(e, DIRTY);
|
|
451
|
+
this.schedule(e);
|
|
452
|
+
}
|
|
453
|
+
for (const e of this.#maybe_dirty_effects) {
|
|
454
|
+
set_signal_status(e, MAYBE_DIRTY);
|
|
455
|
+
this.schedule(e);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
const roots = this.#roots;
|
|
459
|
+
this.#roots = [];
|
|
413
460
|
this.apply();
|
|
414
461
|
var effects = collected_effects = [];
|
|
415
462
|
var render_effects = [];
|
|
416
|
-
|
|
417
|
-
|
|
463
|
+
var updates = legacy_updates = [];
|
|
464
|
+
for (const root2 of roots) {
|
|
465
|
+
try {
|
|
466
|
+
this.#traverse(root2, effects, render_effects);
|
|
467
|
+
} catch (e) {
|
|
468
|
+
reset_all(root2);
|
|
469
|
+
throw e;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
current_batch = null;
|
|
473
|
+
if (updates.length > 0) {
|
|
474
|
+
var batch = Batch.ensure();
|
|
475
|
+
for (const e of updates) {
|
|
476
|
+
batch.schedule(e);
|
|
477
|
+
}
|
|
418
478
|
}
|
|
419
479
|
collected_effects = null;
|
|
420
|
-
|
|
480
|
+
legacy_updates = null;
|
|
481
|
+
if (this.#is_deferred() || this.#is_blocked()) {
|
|
421
482
|
this.#defer_effects(render_effects);
|
|
422
483
|
this.#defer_effects(effects);
|
|
423
484
|
for (const [e, t] of this.#skipped_branches) {
|
|
424
485
|
reset_branch(e, t);
|
|
425
486
|
}
|
|
426
487
|
} else {
|
|
427
|
-
|
|
488
|
+
if (this.#pending.size === 0) {
|
|
489
|
+
batches.delete(this);
|
|
490
|
+
}
|
|
491
|
+
this.#dirty_effects.clear();
|
|
492
|
+
this.#maybe_dirty_effects.clear();
|
|
428
493
|
for (const fn of this.#commit_callbacks) fn(this);
|
|
429
494
|
this.#commit_callbacks.clear();
|
|
430
|
-
if (this.#pending === 0) {
|
|
431
|
-
this.#commit();
|
|
432
|
-
}
|
|
433
495
|
flush_queued_effects(render_effects);
|
|
434
496
|
flush_queued_effects(effects);
|
|
435
|
-
this.#dirty_effects.clear();
|
|
436
|
-
this.#maybe_dirty_effects.clear();
|
|
437
497
|
this.#deferred?.resolve();
|
|
438
498
|
}
|
|
439
|
-
|
|
499
|
+
var next_batch = (
|
|
500
|
+
/** @type {Batch | null} */
|
|
501
|
+
/** @type {unknown} */
|
|
502
|
+
current_batch
|
|
503
|
+
);
|
|
504
|
+
if (this.#roots.length > 0) {
|
|
505
|
+
const batch2 = next_batch ??= this;
|
|
506
|
+
batch2.#roots.push(...this.#roots.filter((r) => !batch2.#roots.includes(r)));
|
|
507
|
+
}
|
|
508
|
+
if (next_batch !== null) {
|
|
509
|
+
batches.add(next_batch);
|
|
510
|
+
next_batch.#process();
|
|
511
|
+
}
|
|
512
|
+
if (!batches.has(this)) {
|
|
513
|
+
this.#commit();
|
|
514
|
+
}
|
|
440
515
|
}
|
|
441
516
|
/**
|
|
442
517
|
* Traverse the effect tree, executing effects or stashing
|
|
@@ -445,28 +520,22 @@ class Batch {
|
|
|
445
520
|
* @param {Effect[]} effects
|
|
446
521
|
* @param {Effect[]} render_effects
|
|
447
522
|
*/
|
|
448
|
-
#
|
|
523
|
+
#traverse(root2, effects, render_effects) {
|
|
449
524
|
root2.f ^= CLEAN;
|
|
450
525
|
var effect = root2.first;
|
|
451
526
|
while (effect !== null) {
|
|
452
527
|
var flags2 = effect.f;
|
|
453
528
|
var is_branch = (flags2 & (BRANCH_EFFECT | ROOT_EFFECT)) !== 0;
|
|
454
529
|
var is_skippable_branch = is_branch && (flags2 & CLEAN) !== 0;
|
|
455
|
-
var
|
|
456
|
-
var skip = is_skippable_branch || this.#skipped_branches.has(effect);
|
|
530
|
+
var skip = is_skippable_branch || (flags2 & INERT) !== 0 || this.#skipped_branches.has(effect);
|
|
457
531
|
if (!skip && effect.fn !== null) {
|
|
458
532
|
if (is_branch) {
|
|
459
|
-
|
|
533
|
+
effect.f ^= CLEAN;
|
|
460
534
|
} else if ((flags2 & EFFECT) !== 0) {
|
|
461
535
|
effects.push(effect);
|
|
462
|
-
} else if ((flags2 & (RENDER_EFFECT | MANAGED_EFFECT)) !== 0 && inert) {
|
|
463
|
-
render_effects.push(effect);
|
|
464
536
|
} else if (is_dirty(effect)) {
|
|
537
|
+
if ((flags2 & BLOCK_EFFECT) !== 0) this.#maybe_dirty_effects.add(effect);
|
|
465
538
|
update_effect(effect);
|
|
466
|
-
if ((flags2 & BLOCK_EFFECT) !== 0) {
|
|
467
|
-
this.#maybe_dirty_effects.add(effect);
|
|
468
|
-
if (inert) set_signal_status(effect, DIRTY);
|
|
469
|
-
}
|
|
470
539
|
}
|
|
471
540
|
var child = effect.first;
|
|
472
541
|
if (child !== null) {
|
|
@@ -495,131 +564,149 @@ class Batch {
|
|
|
495
564
|
/**
|
|
496
565
|
* Associate a change to a given source with the current
|
|
497
566
|
* batch, noting its previous and current values
|
|
498
|
-
* @param {
|
|
499
|
-
* @param {any}
|
|
567
|
+
* @param {Value} source
|
|
568
|
+
* @param {any} old_value
|
|
569
|
+
* @param {boolean} [is_derived]
|
|
500
570
|
*/
|
|
501
|
-
capture(source2,
|
|
502
|
-
if (
|
|
503
|
-
this.previous.set(source2,
|
|
571
|
+
capture(source2, old_value, is_derived = false) {
|
|
572
|
+
if (old_value !== UNINITIALIZED && !this.previous.has(source2)) {
|
|
573
|
+
this.previous.set(source2, old_value);
|
|
504
574
|
}
|
|
505
575
|
if ((source2.f & ERROR_VALUE) === 0) {
|
|
506
|
-
this.current.set(source2, source2.v);
|
|
576
|
+
this.current.set(source2, [source2.v, is_derived]);
|
|
507
577
|
batch_values?.set(source2, source2.v);
|
|
508
578
|
}
|
|
509
579
|
}
|
|
510
580
|
activate() {
|
|
511
581
|
current_batch = this;
|
|
512
|
-
this.apply();
|
|
513
582
|
}
|
|
514
583
|
deactivate() {
|
|
515
|
-
if (current_batch !== this) return;
|
|
516
584
|
current_batch = null;
|
|
517
585
|
batch_values = null;
|
|
518
586
|
}
|
|
519
587
|
flush() {
|
|
520
|
-
|
|
588
|
+
try {
|
|
589
|
+
is_processing = true;
|
|
521
590
|
current_batch = this;
|
|
522
|
-
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
591
|
+
this.#process();
|
|
592
|
+
} finally {
|
|
593
|
+
flush_count = 0;
|
|
594
|
+
last_scheduled_effect = null;
|
|
595
|
+
collected_effects = null;
|
|
596
|
+
legacy_updates = null;
|
|
597
|
+
is_processing = false;
|
|
598
|
+
current_batch = null;
|
|
599
|
+
batch_values = null;
|
|
600
|
+
old_values.clear();
|
|
528
601
|
}
|
|
529
|
-
this.deactivate();
|
|
530
602
|
}
|
|
531
603
|
discard() {
|
|
532
604
|
for (const fn of this.#discard_callbacks) fn(this);
|
|
533
605
|
this.#discard_callbacks.clear();
|
|
606
|
+
batches.delete(this);
|
|
534
607
|
}
|
|
535
608
|
#commit() {
|
|
536
|
-
|
|
537
|
-
this.
|
|
538
|
-
var
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
if (is_earlier && value !== batch.current.get(source2)) {
|
|
550
|
-
batch.current.set(source2, value);
|
|
551
|
-
} else {
|
|
552
|
-
continue;
|
|
553
|
-
}
|
|
609
|
+
for (const batch of batches) {
|
|
610
|
+
var is_earlier = batch.id < this.id;
|
|
611
|
+
var sources = [];
|
|
612
|
+
for (const [source3, [value, is_derived]] of this.current) {
|
|
613
|
+
if (batch.current.has(source3)) {
|
|
614
|
+
var batch_value = (
|
|
615
|
+
/** @type {[any, boolean]} */
|
|
616
|
+
batch.current.get(source3)[0]
|
|
617
|
+
);
|
|
618
|
+
if (is_earlier && value !== batch_value) {
|
|
619
|
+
batch.current.set(source3, [value, is_derived]);
|
|
620
|
+
} else {
|
|
621
|
+
continue;
|
|
554
622
|
}
|
|
555
|
-
sources.push(source2);
|
|
556
623
|
}
|
|
557
|
-
|
|
558
|
-
|
|
624
|
+
sources.push(source3);
|
|
625
|
+
}
|
|
626
|
+
var others = [...batch.current.keys()].filter((s) => !this.current.has(s));
|
|
627
|
+
if (others.length === 0) {
|
|
628
|
+
if (is_earlier) {
|
|
629
|
+
batch.discard();
|
|
559
630
|
}
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
batch.apply();
|
|
572
|
-
for (const root2 of queued_root_effects) {
|
|
573
|
-
batch.#traverse_effect_tree(root2, [], []);
|
|
574
|
-
}
|
|
575
|
-
batch.deactivate();
|
|
631
|
+
} else if (sources.length > 0) {
|
|
632
|
+
batch.activate();
|
|
633
|
+
var marked = /* @__PURE__ */ new Set();
|
|
634
|
+
var checked = /* @__PURE__ */ new Map();
|
|
635
|
+
for (var source2 of sources) {
|
|
636
|
+
mark_effects(source2, others, marked, checked);
|
|
637
|
+
}
|
|
638
|
+
if (batch.#roots.length > 0) {
|
|
639
|
+
batch.apply();
|
|
640
|
+
for (var root2 of batch.#roots) {
|
|
641
|
+
batch.#traverse(root2, [], []);
|
|
576
642
|
}
|
|
577
|
-
|
|
643
|
+
batch.#roots = [];
|
|
644
|
+
}
|
|
645
|
+
batch.deactivate();
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
for (const batch of batches) {
|
|
649
|
+
if (batch.#blockers.has(this)) {
|
|
650
|
+
batch.#blockers.delete(this);
|
|
651
|
+
if (batch.#blockers.size === 0 && !batch.#is_deferred()) {
|
|
652
|
+
batch.activate();
|
|
653
|
+
batch.#process();
|
|
578
654
|
}
|
|
579
655
|
}
|
|
580
|
-
current_batch = previous_batch;
|
|
581
|
-
batch_values = previous_batch_values;
|
|
582
656
|
}
|
|
583
|
-
this.#skipped_branches.clear();
|
|
584
|
-
batches.delete(this);
|
|
585
657
|
}
|
|
586
658
|
/**
|
|
587
|
-
*
|
|
588
659
|
* @param {boolean} blocking
|
|
660
|
+
* @param {Effect} effect
|
|
589
661
|
*/
|
|
590
|
-
increment(blocking) {
|
|
591
|
-
this.#pending
|
|
592
|
-
|
|
662
|
+
increment(blocking, effect) {
|
|
663
|
+
let pending_count = this.#pending.get(effect) ?? 0;
|
|
664
|
+
this.#pending.set(effect, pending_count + 1);
|
|
665
|
+
if (blocking) {
|
|
666
|
+
let blocking_pending_count = this.#blocking_pending.get(effect) ?? 0;
|
|
667
|
+
this.#blocking_pending.set(effect, blocking_pending_count + 1);
|
|
668
|
+
}
|
|
593
669
|
}
|
|
594
670
|
/**
|
|
595
|
-
*
|
|
596
671
|
* @param {boolean} blocking
|
|
672
|
+
* @param {Effect} effect
|
|
673
|
+
* @param {boolean} skip - whether to skip updates (because this is triggered by a stale reaction)
|
|
597
674
|
*/
|
|
598
|
-
decrement(blocking) {
|
|
599
|
-
this.#pending
|
|
600
|
-
if (
|
|
601
|
-
|
|
675
|
+
decrement(blocking, effect, skip) {
|
|
676
|
+
let pending_count = this.#pending.get(effect) ?? 0;
|
|
677
|
+
if (pending_count === 1) {
|
|
678
|
+
this.#pending.delete(effect);
|
|
679
|
+
} else {
|
|
680
|
+
this.#pending.set(effect, pending_count - 1);
|
|
681
|
+
}
|
|
682
|
+
if (blocking) {
|
|
683
|
+
let blocking_pending_count = this.#blocking_pending.get(effect) ?? 0;
|
|
684
|
+
if (blocking_pending_count === 1) {
|
|
685
|
+
this.#blocking_pending.delete(effect);
|
|
686
|
+
} else {
|
|
687
|
+
this.#blocking_pending.set(effect, blocking_pending_count - 1);
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
if (this.#decrement_queued || skip) return;
|
|
602
691
|
this.#decrement_queued = true;
|
|
603
692
|
queue_micro_task(() => {
|
|
604
693
|
this.#decrement_queued = false;
|
|
605
|
-
|
|
606
|
-
this.revive();
|
|
607
|
-
} else if (queued_root_effects.length > 0) {
|
|
608
|
-
this.flush();
|
|
609
|
-
}
|
|
694
|
+
this.flush();
|
|
610
695
|
});
|
|
611
696
|
}
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
697
|
+
/**
|
|
698
|
+
* @param {Set<Effect>} dirty_effects
|
|
699
|
+
* @param {Set<Effect>} maybe_dirty_effects
|
|
700
|
+
*/
|
|
701
|
+
transfer_effects(dirty_effects, maybe_dirty_effects) {
|
|
702
|
+
for (const e of dirty_effects) {
|
|
703
|
+
this.#dirty_effects.add(e);
|
|
617
704
|
}
|
|
618
|
-
for (const e of
|
|
619
|
-
|
|
620
|
-
schedule_effect(e);
|
|
705
|
+
for (const e of maybe_dirty_effects) {
|
|
706
|
+
this.#maybe_dirty_effects.add(e);
|
|
621
707
|
}
|
|
622
|
-
|
|
708
|
+
dirty_effects.clear();
|
|
709
|
+
maybe_dirty_effects.clear();
|
|
623
710
|
}
|
|
624
711
|
/** @param {(batch: Batch) => void} fn */
|
|
625
712
|
oncommit(fn) {
|
|
@@ -635,20 +722,53 @@ class Batch {
|
|
|
635
722
|
static ensure() {
|
|
636
723
|
if (current_batch === null) {
|
|
637
724
|
const batch = current_batch = new Batch();
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
725
|
+
if (!is_processing) {
|
|
726
|
+
batches.add(current_batch);
|
|
727
|
+
if (!is_flushing_sync) {
|
|
728
|
+
queue_micro_task(() => {
|
|
729
|
+
if (current_batch !== batch) {
|
|
730
|
+
return;
|
|
731
|
+
}
|
|
732
|
+
batch.flush();
|
|
733
|
+
});
|
|
734
|
+
}
|
|
646
735
|
}
|
|
647
736
|
}
|
|
648
737
|
return current_batch;
|
|
649
738
|
}
|
|
650
739
|
apply() {
|
|
651
|
-
|
|
740
|
+
{
|
|
741
|
+
batch_values = null;
|
|
742
|
+
return;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
*
|
|
747
|
+
* @param {Effect} effect
|
|
748
|
+
*/
|
|
749
|
+
schedule(effect) {
|
|
750
|
+
last_scheduled_effect = effect;
|
|
751
|
+
if (effect.b?.is_pending && (effect.f & (EFFECT | RENDER_EFFECT | MANAGED_EFFECT)) !== 0 && (effect.f & REACTION_RAN) === 0) {
|
|
752
|
+
effect.b.defer_effect(effect);
|
|
753
|
+
return;
|
|
754
|
+
}
|
|
755
|
+
var e = effect;
|
|
756
|
+
while (e.parent !== null) {
|
|
757
|
+
e = e.parent;
|
|
758
|
+
var flags2 = e.f;
|
|
759
|
+
if (collected_effects !== null && e === active_effect) {
|
|
760
|
+
if ((active_reaction === null || (active_reaction.f & DERIVED) === 0) && true) {
|
|
761
|
+
return;
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
if ((flags2 & (ROOT_EFFECT | BRANCH_EFFECT)) !== 0) {
|
|
765
|
+
if ((flags2 & CLEAN) === 0) {
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
768
|
+
e.f ^= CLEAN;
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
this.#roots.push(e);
|
|
652
772
|
}
|
|
653
773
|
}
|
|
654
774
|
function flushSync(fn) {
|
|
@@ -659,43 +779,18 @@ function flushSync(fn) {
|
|
|
659
779
|
if (fn) ;
|
|
660
780
|
while (true) {
|
|
661
781
|
flush_tasks();
|
|
662
|
-
if (
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
/** @type {T} */
|
|
668
|
-
result
|
|
669
|
-
);
|
|
670
|
-
}
|
|
782
|
+
if (current_batch === null) {
|
|
783
|
+
return (
|
|
784
|
+
/** @type {T} */
|
|
785
|
+
result
|
|
786
|
+
);
|
|
671
787
|
}
|
|
672
|
-
|
|
788
|
+
current_batch.flush();
|
|
673
789
|
}
|
|
674
790
|
} finally {
|
|
675
791
|
is_flushing_sync = was_flushing_sync;
|
|
676
792
|
}
|
|
677
793
|
}
|
|
678
|
-
function flush_effects() {
|
|
679
|
-
var source_stacks = null;
|
|
680
|
-
try {
|
|
681
|
-
var flush_count = 0;
|
|
682
|
-
while (queued_root_effects.length > 0) {
|
|
683
|
-
var batch = Batch.ensure();
|
|
684
|
-
if (flush_count++ > 1e3) {
|
|
685
|
-
var updates, entry;
|
|
686
|
-
if (BROWSER) ;
|
|
687
|
-
infinite_loop_guard();
|
|
688
|
-
}
|
|
689
|
-
batch.process(queued_root_effects);
|
|
690
|
-
old_values.clear();
|
|
691
|
-
if (BROWSER) ;
|
|
692
|
-
}
|
|
693
|
-
} finally {
|
|
694
|
-
queued_root_effects = [];
|
|
695
|
-
last_scheduled_effect = null;
|
|
696
|
-
collected_effects = null;
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
794
|
function infinite_loop_guard() {
|
|
700
795
|
try {
|
|
701
796
|
effect_update_depth_exceeded();
|
|
@@ -791,29 +886,8 @@ function depends_on(reaction, sources, checked) {
|
|
|
791
886
|
checked.set(reaction, false);
|
|
792
887
|
return false;
|
|
793
888
|
}
|
|
794
|
-
function schedule_effect(
|
|
795
|
-
|
|
796
|
-
var boundary2 = effect.b;
|
|
797
|
-
if (boundary2?.is_pending && (signal.f & (EFFECT | RENDER_EFFECT | MANAGED_EFFECT)) !== 0 && (signal.f & REACTION_RAN) === 0) {
|
|
798
|
-
boundary2.defer_effect(signal);
|
|
799
|
-
return;
|
|
800
|
-
}
|
|
801
|
-
while (effect.parent !== null) {
|
|
802
|
-
effect = effect.parent;
|
|
803
|
-
var flags2 = effect.f;
|
|
804
|
-
if (collected_effects !== null && effect === active_effect) {
|
|
805
|
-
if ((signal.f & RENDER_EFFECT) === 0) {
|
|
806
|
-
return;
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
if ((flags2 & (ROOT_EFFECT | BRANCH_EFFECT)) !== 0) {
|
|
810
|
-
if ((flags2 & CLEAN) === 0) {
|
|
811
|
-
return;
|
|
812
|
-
}
|
|
813
|
-
effect.f ^= CLEAN;
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
queued_root_effects.push(effect);
|
|
889
|
+
function schedule_effect(effect) {
|
|
890
|
+
current_batch.schedule(effect);
|
|
817
891
|
}
|
|
818
892
|
function reset_branch(effect, tracked) {
|
|
819
893
|
if ((effect.f & BRANCH_EFFECT) !== 0 && (effect.f & CLEAN) !== 0) {
|
|
@@ -831,6 +905,14 @@ function reset_branch(effect, tracked) {
|
|
|
831
905
|
e = e.next;
|
|
832
906
|
}
|
|
833
907
|
}
|
|
908
|
+
function reset_all(effect) {
|
|
909
|
+
set_signal_status(effect, CLEAN);
|
|
910
|
+
var e = effect.first;
|
|
911
|
+
while (e !== null) {
|
|
912
|
+
reset_all(e);
|
|
913
|
+
e = e.next;
|
|
914
|
+
}
|
|
915
|
+
}
|
|
834
916
|
function createSubscriber(start) {
|
|
835
917
|
let subscribers = 0;
|
|
836
918
|
let version = source(0);
|
|
@@ -988,7 +1070,6 @@ class Boundary {
|
|
|
988
1070
|
var anchor = create_text();
|
|
989
1071
|
fragment.append(anchor);
|
|
990
1072
|
this.#main_effect = this.#run(() => {
|
|
991
|
-
Batch.ensure();
|
|
992
1073
|
return branch(() => this.#children(anchor));
|
|
993
1074
|
});
|
|
994
1075
|
if (this.#pending_count === 0) {
|
|
@@ -1001,7 +1082,10 @@ class Boundary {
|
|
|
1001
1082
|
this.#pending_effect = null;
|
|
1002
1083
|
}
|
|
1003
1084
|
);
|
|
1004
|
-
this.#resolve(
|
|
1085
|
+
this.#resolve(
|
|
1086
|
+
/** @type {Batch} */
|
|
1087
|
+
current_batch
|
|
1088
|
+
);
|
|
1005
1089
|
}
|
|
1006
1090
|
});
|
|
1007
1091
|
}
|
|
@@ -1022,24 +1106,21 @@ class Boundary {
|
|
|
1022
1106
|
);
|
|
1023
1107
|
this.#pending_effect = branch(() => pending(this.#anchor));
|
|
1024
1108
|
} else {
|
|
1025
|
-
this.#resolve(
|
|
1109
|
+
this.#resolve(
|
|
1110
|
+
/** @type {Batch} */
|
|
1111
|
+
current_batch
|
|
1112
|
+
);
|
|
1026
1113
|
}
|
|
1027
1114
|
} catch (error) {
|
|
1028
1115
|
this.error(error);
|
|
1029
1116
|
}
|
|
1030
1117
|
}
|
|
1031
|
-
|
|
1118
|
+
/**
|
|
1119
|
+
* @param {Batch} batch
|
|
1120
|
+
*/
|
|
1121
|
+
#resolve(batch) {
|
|
1032
1122
|
this.is_pending = false;
|
|
1033
|
-
|
|
1034
|
-
set_signal_status(e, DIRTY);
|
|
1035
|
-
schedule_effect(e);
|
|
1036
|
-
}
|
|
1037
|
-
for (const e of this.#maybe_dirty_effects) {
|
|
1038
|
-
set_signal_status(e, MAYBE_DIRTY);
|
|
1039
|
-
schedule_effect(e);
|
|
1040
|
-
}
|
|
1041
|
-
this.#dirty_effects.clear();
|
|
1042
|
-
this.#maybe_dirty_effects.clear();
|
|
1123
|
+
batch.transfer_effects(this.#dirty_effects, this.#maybe_dirty_effects);
|
|
1043
1124
|
}
|
|
1044
1125
|
/**
|
|
1045
1126
|
* Defer an effect inside a pending boundary until the boundary resolves
|
|
@@ -1070,6 +1151,7 @@ class Boundary {
|
|
|
1070
1151
|
set_active_reaction(this.#effect);
|
|
1071
1152
|
set_component_context(this.#effect.ctx);
|
|
1072
1153
|
try {
|
|
1154
|
+
Batch.ensure();
|
|
1073
1155
|
return fn();
|
|
1074
1156
|
} catch (e) {
|
|
1075
1157
|
handle_error(e);
|
|
@@ -1084,17 +1166,18 @@ class Boundary {
|
|
|
1084
1166
|
* Updates the pending count associated with the currently visible pending snippet,
|
|
1085
1167
|
* if any, such that we can replace the snippet with content once work is done
|
|
1086
1168
|
* @param {1 | -1} d
|
|
1169
|
+
* @param {Batch} batch
|
|
1087
1170
|
*/
|
|
1088
|
-
#update_pending_count(d) {
|
|
1171
|
+
#update_pending_count(d, batch) {
|
|
1089
1172
|
if (!this.has_pending_snippet()) {
|
|
1090
1173
|
if (this.parent) {
|
|
1091
|
-
this.parent.#update_pending_count(d);
|
|
1174
|
+
this.parent.#update_pending_count(d, batch);
|
|
1092
1175
|
}
|
|
1093
1176
|
return;
|
|
1094
1177
|
}
|
|
1095
1178
|
this.#pending_count += d;
|
|
1096
1179
|
if (this.#pending_count === 0) {
|
|
1097
|
-
this.#resolve();
|
|
1180
|
+
this.#resolve(batch);
|
|
1098
1181
|
if (this.#pending_effect) {
|
|
1099
1182
|
pause_effect(this.#pending_effect, () => {
|
|
1100
1183
|
this.#pending_effect = null;
|
|
@@ -1111,9 +1194,10 @@ class Boundary {
|
|
|
1111
1194
|
* and controls when the current `pending` snippet (if any) is removed.
|
|
1112
1195
|
* Do not call from inside the class
|
|
1113
1196
|
* @param {1 | -1} d
|
|
1197
|
+
* @param {Batch} batch
|
|
1114
1198
|
*/
|
|
1115
|
-
update_pending_count(d) {
|
|
1116
|
-
this.#update_pending_count(d);
|
|
1199
|
+
update_pending_count(d, batch) {
|
|
1200
|
+
this.#update_pending_count(d, batch);
|
|
1117
1201
|
this.#local_pending_count += d;
|
|
1118
1202
|
if (!this.#effect_pending || this.#pending_count_update_queued) return;
|
|
1119
1203
|
this.#pending_count_update_queued = true;
|
|
@@ -1175,7 +1259,6 @@ class Boundary {
|
|
|
1175
1259
|
});
|
|
1176
1260
|
}
|
|
1177
1261
|
this.#run(() => {
|
|
1178
|
-
Batch.ensure();
|
|
1179
1262
|
this.#render();
|
|
1180
1263
|
});
|
|
1181
1264
|
};
|
|
@@ -1189,7 +1272,6 @@ class Boundary {
|
|
|
1189
1272
|
}
|
|
1190
1273
|
if (failed) {
|
|
1191
1274
|
this.#failed_effect = this.#run(() => {
|
|
1192
|
-
Batch.ensure();
|
|
1193
1275
|
try {
|
|
1194
1276
|
return branch(() => {
|
|
1195
1277
|
var effect = (
|
|
@@ -1277,11 +1359,13 @@ function execute_derived(derived2) {
|
|
|
1277
1359
|
return value;
|
|
1278
1360
|
}
|
|
1279
1361
|
function update_derived(derived2) {
|
|
1362
|
+
var old_value = derived2.v;
|
|
1280
1363
|
var value = execute_derived(derived2);
|
|
1281
1364
|
if (!derived2.equals(value)) {
|
|
1282
1365
|
derived2.wv = increment_write_version();
|
|
1283
1366
|
if (!current_batch?.is_fork || derived2.deps === null) {
|
|
1284
1367
|
derived2.v = value;
|
|
1368
|
+
current_batch?.capture(derived2, old_value, true);
|
|
1285
1369
|
if (derived2.deps === null) {
|
|
1286
1370
|
set_signal_status(derived2, CLEAN);
|
|
1287
1371
|
return;
|
|
@@ -1356,9 +1440,9 @@ function set(source2, value, should_proxy = false) {
|
|
|
1356
1440
|
state_unsafe_mutation();
|
|
1357
1441
|
}
|
|
1358
1442
|
let new_value = should_proxy ? proxy(value) : value;
|
|
1359
|
-
return internal_set(source2, new_value);
|
|
1443
|
+
return internal_set(source2, new_value, legacy_updates);
|
|
1360
1444
|
}
|
|
1361
|
-
function internal_set(source2, value) {
|
|
1445
|
+
function internal_set(source2, value, updated_during_traversal = null) {
|
|
1362
1446
|
if (!source2.equals(value)) {
|
|
1363
1447
|
var old_value = source2.v;
|
|
1364
1448
|
if (is_destroying_effect) {
|
|
@@ -1377,10 +1461,12 @@ function internal_set(source2, value) {
|
|
|
1377
1461
|
if ((source2.f & DIRTY) !== 0) {
|
|
1378
1462
|
execute_derived(derived2);
|
|
1379
1463
|
}
|
|
1380
|
-
|
|
1464
|
+
if (batch_values === null) {
|
|
1465
|
+
update_derived_status(derived2);
|
|
1466
|
+
}
|
|
1381
1467
|
}
|
|
1382
1468
|
source2.wv = increment_write_version();
|
|
1383
|
-
mark_reactions(source2, DIRTY);
|
|
1469
|
+
mark_reactions(source2, DIRTY, updated_during_traversal);
|
|
1384
1470
|
if (active_effect !== null && (active_effect.f & CLEAN) !== 0 && (active_effect.f & (BRANCH_EFFECT | ROOT_EFFECT)) === 0) {
|
|
1385
1471
|
if (untracked_writes === null) {
|
|
1386
1472
|
set_untracked_writes([source2]);
|
|
@@ -1409,7 +1495,7 @@ function flush_eager_effects() {
|
|
|
1409
1495
|
function increment(source2) {
|
|
1410
1496
|
set(source2, source2.v + 1);
|
|
1411
1497
|
}
|
|
1412
|
-
function mark_reactions(signal, status) {
|
|
1498
|
+
function mark_reactions(signal, status, updated_during_traversal) {
|
|
1413
1499
|
var reactions = signal.reactions;
|
|
1414
1500
|
if (reactions === null) return;
|
|
1415
1501
|
var length = reactions.length;
|
|
@@ -1430,19 +1516,21 @@ function mark_reactions(signal, status) {
|
|
|
1430
1516
|
if (flags2 & CONNECTED) {
|
|
1431
1517
|
reaction.f |= WAS_MARKED;
|
|
1432
1518
|
}
|
|
1433
|
-
mark_reactions(derived2, MAYBE_DIRTY);
|
|
1519
|
+
mark_reactions(derived2, MAYBE_DIRTY, updated_during_traversal);
|
|
1434
1520
|
}
|
|
1435
1521
|
} else if (not_dirty) {
|
|
1436
|
-
|
|
1437
|
-
eager_block_effects.add(
|
|
1438
|
-
/** @type {Effect} */
|
|
1439
|
-
reaction
|
|
1440
|
-
);
|
|
1441
|
-
}
|
|
1442
|
-
schedule_effect(
|
|
1522
|
+
var effect = (
|
|
1443
1523
|
/** @type {Effect} */
|
|
1444
1524
|
reaction
|
|
1445
1525
|
);
|
|
1526
|
+
if ((flags2 & BLOCK_EFFECT) !== 0 && eager_block_effects !== null) {
|
|
1527
|
+
eager_block_effects.add(effect);
|
|
1528
|
+
}
|
|
1529
|
+
if (updated_during_traversal !== null) {
|
|
1530
|
+
updated_during_traversal.push(effect);
|
|
1531
|
+
} else {
|
|
1532
|
+
schedule_effect(effect);
|
|
1533
|
+
}
|
|
1446
1534
|
}
|
|
1447
1535
|
}
|
|
1448
1536
|
}
|
|
@@ -1728,7 +1816,7 @@ function create_effect(type, fn) {
|
|
|
1728
1816
|
if (collected_effects !== null) {
|
|
1729
1817
|
collected_effects.push(effect);
|
|
1730
1818
|
} else {
|
|
1731
|
-
|
|
1819
|
+
Batch.ensure().schedule(effect);
|
|
1732
1820
|
}
|
|
1733
1821
|
} else if (fn !== null) {
|
|
1734
1822
|
try {
|
|
@@ -1847,9 +1935,9 @@ function destroy_effect(effect, remove_dom = true) {
|
|
|
1847
1935
|
);
|
|
1848
1936
|
removed = true;
|
|
1849
1937
|
}
|
|
1938
|
+
set_signal_status(effect, DESTROYING);
|
|
1850
1939
|
destroy_effect_children(effect, remove_dom && !removed);
|
|
1851
1940
|
remove_reactions(effect, 0);
|
|
1852
|
-
set_signal_status(effect, DESTROYED);
|
|
1853
1941
|
var transitions = effect.nodes && effect.nodes.t;
|
|
1854
1942
|
if (transitions !== null) {
|
|
1855
1943
|
for (const transition of transitions) {
|
|
@@ -1857,11 +1945,13 @@ function destroy_effect(effect, remove_dom = true) {
|
|
|
1857
1945
|
}
|
|
1858
1946
|
}
|
|
1859
1947
|
execute_effect_teardown(effect);
|
|
1948
|
+
effect.f ^= DESTROYING;
|
|
1949
|
+
effect.f |= DESTROYED;
|
|
1860
1950
|
var parent = effect.parent;
|
|
1861
1951
|
if (parent !== null && parent.first !== null) {
|
|
1862
1952
|
unlink_effect(effect);
|
|
1863
1953
|
}
|
|
1864
|
-
effect.next = effect.prev = effect.teardown = effect.ctx = effect.deps = effect.fn = effect.nodes = effect.ac = null;
|
|
1954
|
+
effect.next = effect.prev = effect.teardown = effect.ctx = effect.deps = effect.fn = effect.nodes = effect.ac = effect.b = null;
|
|
1865
1955
|
}
|
|
1866
1956
|
function remove_effect_dom(node, end) {
|
|
1867
1957
|
while (node !== null) {
|
|
@@ -2313,75 +2403,6 @@ function untrack(fn) {
|
|
|
2313
2403
|
untracking = previous_untracking;
|
|
2314
2404
|
}
|
|
2315
2405
|
}
|
|
2316
|
-
const VOID_ELEMENT_NAMES = [
|
|
2317
|
-
"area",
|
|
2318
|
-
"base",
|
|
2319
|
-
"br",
|
|
2320
|
-
"col",
|
|
2321
|
-
"command",
|
|
2322
|
-
"embed",
|
|
2323
|
-
"hr",
|
|
2324
|
-
"img",
|
|
2325
|
-
"input",
|
|
2326
|
-
"keygen",
|
|
2327
|
-
"link",
|
|
2328
|
-
"meta",
|
|
2329
|
-
"param",
|
|
2330
|
-
"source",
|
|
2331
|
-
"track",
|
|
2332
|
-
"wbr"
|
|
2333
|
-
];
|
|
2334
|
-
function is_void(name) {
|
|
2335
|
-
return VOID_ELEMENT_NAMES.includes(name) || name.toLowerCase() === "!doctype";
|
|
2336
|
-
}
|
|
2337
|
-
const DOM_BOOLEAN_ATTRIBUTES = [
|
|
2338
|
-
"allowfullscreen",
|
|
2339
|
-
"async",
|
|
2340
|
-
"autofocus",
|
|
2341
|
-
"autoplay",
|
|
2342
|
-
"checked",
|
|
2343
|
-
"controls",
|
|
2344
|
-
"default",
|
|
2345
|
-
"disabled",
|
|
2346
|
-
"formnovalidate",
|
|
2347
|
-
"indeterminate",
|
|
2348
|
-
"inert",
|
|
2349
|
-
"ismap",
|
|
2350
|
-
"loop",
|
|
2351
|
-
"multiple",
|
|
2352
|
-
"muted",
|
|
2353
|
-
"nomodule",
|
|
2354
|
-
"novalidate",
|
|
2355
|
-
"open",
|
|
2356
|
-
"playsinline",
|
|
2357
|
-
"readonly",
|
|
2358
|
-
"required",
|
|
2359
|
-
"reversed",
|
|
2360
|
-
"seamless",
|
|
2361
|
-
"selected",
|
|
2362
|
-
"webkitdirectory",
|
|
2363
|
-
"defer",
|
|
2364
|
-
"disablepictureinpicture",
|
|
2365
|
-
"disableremoteplayback"
|
|
2366
|
-
];
|
|
2367
|
-
function is_boolean_attribute(name) {
|
|
2368
|
-
return DOM_BOOLEAN_ATTRIBUTES.includes(name);
|
|
2369
|
-
}
|
|
2370
|
-
const PASSIVE_EVENTS = ["touchstart", "touchmove"];
|
|
2371
|
-
function is_passive_event(name) {
|
|
2372
|
-
return PASSIVE_EVENTS.includes(name);
|
|
2373
|
-
}
|
|
2374
|
-
const RAW_TEXT_ELEMENTS = (
|
|
2375
|
-
/** @type {const} */
|
|
2376
|
-
["textarea", "script", "style", "title"]
|
|
2377
|
-
);
|
|
2378
|
-
function is_raw_text_element(name) {
|
|
2379
|
-
return RAW_TEXT_ELEMENTS.includes(
|
|
2380
|
-
/** @type {typeof RAW_TEXT_ELEMENTS[number]} */
|
|
2381
|
-
name
|
|
2382
|
-
);
|
|
2383
|
-
}
|
|
2384
|
-
const REGEX_VALID_TAG_NAME = /^[a-zA-Z][a-zA-Z0-9]*(-[a-zA-Z0-9.\-_\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}]+)*$/u;
|
|
2385
2406
|
const event_symbol = /* @__PURE__ */ Symbol("events");
|
|
2386
2407
|
const all_registered_events = /* @__PURE__ */ new Set();
|
|
2387
2408
|
const root_event_handles = /* @__PURE__ */ new Set();
|
|
@@ -2505,6 +2526,75 @@ function assign_nodes(start, end) {
|
|
|
2505
2526
|
effect.nodes = { start, end, a: null, t: null };
|
|
2506
2527
|
}
|
|
2507
2528
|
}
|
|
2529
|
+
const VOID_ELEMENT_NAMES = [
|
|
2530
|
+
"area",
|
|
2531
|
+
"base",
|
|
2532
|
+
"br",
|
|
2533
|
+
"col",
|
|
2534
|
+
"command",
|
|
2535
|
+
"embed",
|
|
2536
|
+
"hr",
|
|
2537
|
+
"img",
|
|
2538
|
+
"input",
|
|
2539
|
+
"keygen",
|
|
2540
|
+
"link",
|
|
2541
|
+
"meta",
|
|
2542
|
+
"param",
|
|
2543
|
+
"source",
|
|
2544
|
+
"track",
|
|
2545
|
+
"wbr"
|
|
2546
|
+
];
|
|
2547
|
+
function is_void(name) {
|
|
2548
|
+
return VOID_ELEMENT_NAMES.includes(name) || name.toLowerCase() === "!doctype";
|
|
2549
|
+
}
|
|
2550
|
+
const DOM_BOOLEAN_ATTRIBUTES = [
|
|
2551
|
+
"allowfullscreen",
|
|
2552
|
+
"async",
|
|
2553
|
+
"autofocus",
|
|
2554
|
+
"autoplay",
|
|
2555
|
+
"checked",
|
|
2556
|
+
"controls",
|
|
2557
|
+
"default",
|
|
2558
|
+
"disabled",
|
|
2559
|
+
"formnovalidate",
|
|
2560
|
+
"indeterminate",
|
|
2561
|
+
"inert",
|
|
2562
|
+
"ismap",
|
|
2563
|
+
"loop",
|
|
2564
|
+
"multiple",
|
|
2565
|
+
"muted",
|
|
2566
|
+
"nomodule",
|
|
2567
|
+
"novalidate",
|
|
2568
|
+
"open",
|
|
2569
|
+
"playsinline",
|
|
2570
|
+
"readonly",
|
|
2571
|
+
"required",
|
|
2572
|
+
"reversed",
|
|
2573
|
+
"seamless",
|
|
2574
|
+
"selected",
|
|
2575
|
+
"webkitdirectory",
|
|
2576
|
+
"defer",
|
|
2577
|
+
"disablepictureinpicture",
|
|
2578
|
+
"disableremoteplayback"
|
|
2579
|
+
];
|
|
2580
|
+
function is_boolean_attribute(name) {
|
|
2581
|
+
return DOM_BOOLEAN_ATTRIBUTES.includes(name);
|
|
2582
|
+
}
|
|
2583
|
+
const PASSIVE_EVENTS = ["touchstart", "touchmove"];
|
|
2584
|
+
function is_passive_event(name) {
|
|
2585
|
+
return PASSIVE_EVENTS.includes(name);
|
|
2586
|
+
}
|
|
2587
|
+
const RAW_TEXT_ELEMENTS = (
|
|
2588
|
+
/** @type {const} */
|
|
2589
|
+
["textarea", "script", "style", "title"]
|
|
2590
|
+
);
|
|
2591
|
+
function is_raw_text_element(name) {
|
|
2592
|
+
return RAW_TEXT_ELEMENTS.includes(
|
|
2593
|
+
/** @type {typeof RAW_TEXT_ELEMENTS[number]} */
|
|
2594
|
+
name
|
|
2595
|
+
);
|
|
2596
|
+
}
|
|
2597
|
+
const REGEX_VALID_TAG_NAME = /^[a-zA-Z][a-zA-Z0-9]*(-[a-zA-Z0-9.\-_\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}]+)*$/u;
|
|
2508
2598
|
function mount(component, options) {
|
|
2509
2599
|
return _mount(component, options);
|
|
2510
2600
|
}
|
|
@@ -2661,6 +2751,109 @@ function unmount(component, options) {
|
|
|
2661
2751
|
}
|
|
2662
2752
|
return Promise.resolve();
|
|
2663
2753
|
}
|
|
2754
|
+
function asClassComponent$1(component) {
|
|
2755
|
+
return class extends Svelte4Component {
|
|
2756
|
+
/** @param {any} options */
|
|
2757
|
+
constructor(options) {
|
|
2758
|
+
super({
|
|
2759
|
+
component,
|
|
2760
|
+
...options
|
|
2761
|
+
});
|
|
2762
|
+
}
|
|
2763
|
+
};
|
|
2764
|
+
}
|
|
2765
|
+
class Svelte4Component {
|
|
2766
|
+
/** @type {any} */
|
|
2767
|
+
#events;
|
|
2768
|
+
/** @type {Record<string, any>} */
|
|
2769
|
+
#instance;
|
|
2770
|
+
/**
|
|
2771
|
+
* @param {ComponentConstructorOptions & {
|
|
2772
|
+
* component: any;
|
|
2773
|
+
* }} options
|
|
2774
|
+
*/
|
|
2775
|
+
constructor(options) {
|
|
2776
|
+
var sources = /* @__PURE__ */ new Map();
|
|
2777
|
+
var add_source = (key, value) => {
|
|
2778
|
+
var s = /* @__PURE__ */ mutable_source(value, false, false);
|
|
2779
|
+
sources.set(key, s);
|
|
2780
|
+
return s;
|
|
2781
|
+
};
|
|
2782
|
+
const props = new Proxy(
|
|
2783
|
+
{ ...options.props || {}, $$events: {} },
|
|
2784
|
+
{
|
|
2785
|
+
get(target, prop) {
|
|
2786
|
+
return get(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop)));
|
|
2787
|
+
},
|
|
2788
|
+
has(target, prop) {
|
|
2789
|
+
if (prop === LEGACY_PROPS) return true;
|
|
2790
|
+
get(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop)));
|
|
2791
|
+
return Reflect.has(target, prop);
|
|
2792
|
+
},
|
|
2793
|
+
set(target, prop, value) {
|
|
2794
|
+
set(sources.get(prop) ?? add_source(prop, value), value);
|
|
2795
|
+
return Reflect.set(target, prop, value);
|
|
2796
|
+
}
|
|
2797
|
+
}
|
|
2798
|
+
);
|
|
2799
|
+
this.#instance = (options.hydrate ? hydrate : mount)(options.component, {
|
|
2800
|
+
target: options.target,
|
|
2801
|
+
anchor: options.anchor,
|
|
2802
|
+
props,
|
|
2803
|
+
context: options.context,
|
|
2804
|
+
intro: options.intro ?? false,
|
|
2805
|
+
recover: options.recover,
|
|
2806
|
+
transformError: options.transformError
|
|
2807
|
+
});
|
|
2808
|
+
if (!options?.props?.$$host || options.sync === false) {
|
|
2809
|
+
flushSync();
|
|
2810
|
+
}
|
|
2811
|
+
this.#events = props.$$events;
|
|
2812
|
+
for (const key of Object.keys(this.#instance)) {
|
|
2813
|
+
if (key === "$set" || key === "$destroy" || key === "$on") continue;
|
|
2814
|
+
define_property(this, key, {
|
|
2815
|
+
get() {
|
|
2816
|
+
return this.#instance[key];
|
|
2817
|
+
},
|
|
2818
|
+
/** @param {any} value */
|
|
2819
|
+
set(value) {
|
|
2820
|
+
this.#instance[key] = value;
|
|
2821
|
+
},
|
|
2822
|
+
enumerable: true
|
|
2823
|
+
});
|
|
2824
|
+
}
|
|
2825
|
+
this.#instance.$set = /** @param {Record<string, any>} next */
|
|
2826
|
+
(next2) => {
|
|
2827
|
+
Object.assign(props, next2);
|
|
2828
|
+
};
|
|
2829
|
+
this.#instance.$destroy = () => {
|
|
2830
|
+
unmount(this.#instance);
|
|
2831
|
+
};
|
|
2832
|
+
}
|
|
2833
|
+
/** @param {Record<string, any>} props */
|
|
2834
|
+
$set(props) {
|
|
2835
|
+
this.#instance.$set(props);
|
|
2836
|
+
}
|
|
2837
|
+
/**
|
|
2838
|
+
* @param {string} event
|
|
2839
|
+
* @param {(...args: any[]) => any} callback
|
|
2840
|
+
* @returns {any}
|
|
2841
|
+
*/
|
|
2842
|
+
$on(event, callback) {
|
|
2843
|
+
this.#events[event] = this.#events[event] || [];
|
|
2844
|
+
const cb = (...args) => callback.call(this, ...args);
|
|
2845
|
+
this.#events[event].push(cb);
|
|
2846
|
+
return () => {
|
|
2847
|
+
this.#events[event] = this.#events[event].filter(
|
|
2848
|
+
/** @param {any} fn */
|
|
2849
|
+
(fn) => fn !== cb
|
|
2850
|
+
);
|
|
2851
|
+
};
|
|
2852
|
+
}
|
|
2853
|
+
$destroy() {
|
|
2854
|
+
this.#instance.$destroy();
|
|
2855
|
+
}
|
|
2856
|
+
}
|
|
2664
2857
|
const ATTR_REGEX = /[&"<]/g;
|
|
2665
2858
|
const CONTENT_REGEX = /[&<]/g;
|
|
2666
2859
|
function escape_html(value, is_attr) {
|
|
@@ -2818,109 +3011,6 @@ function to_style(value, styles) {
|
|
|
2818
3011
|
}
|
|
2819
3012
|
return value == null ? null : String(value);
|
|
2820
3013
|
}
|
|
2821
|
-
function asClassComponent$1(component) {
|
|
2822
|
-
return class extends Svelte4Component {
|
|
2823
|
-
/** @param {any} options */
|
|
2824
|
-
constructor(options) {
|
|
2825
|
-
super({
|
|
2826
|
-
component,
|
|
2827
|
-
...options
|
|
2828
|
-
});
|
|
2829
|
-
}
|
|
2830
|
-
};
|
|
2831
|
-
}
|
|
2832
|
-
class Svelte4Component {
|
|
2833
|
-
/** @type {any} */
|
|
2834
|
-
#events;
|
|
2835
|
-
/** @type {Record<string, any>} */
|
|
2836
|
-
#instance;
|
|
2837
|
-
/**
|
|
2838
|
-
* @param {ComponentConstructorOptions & {
|
|
2839
|
-
* component: any;
|
|
2840
|
-
* }} options
|
|
2841
|
-
*/
|
|
2842
|
-
constructor(options) {
|
|
2843
|
-
var sources = /* @__PURE__ */ new Map();
|
|
2844
|
-
var add_source = (key, value) => {
|
|
2845
|
-
var s = /* @__PURE__ */ mutable_source(value, false, false);
|
|
2846
|
-
sources.set(key, s);
|
|
2847
|
-
return s;
|
|
2848
|
-
};
|
|
2849
|
-
const props = new Proxy(
|
|
2850
|
-
{ ...options.props || {}, $$events: {} },
|
|
2851
|
-
{
|
|
2852
|
-
get(target, prop) {
|
|
2853
|
-
return get(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop)));
|
|
2854
|
-
},
|
|
2855
|
-
has(target, prop) {
|
|
2856
|
-
if (prop === LEGACY_PROPS) return true;
|
|
2857
|
-
get(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop)));
|
|
2858
|
-
return Reflect.has(target, prop);
|
|
2859
|
-
},
|
|
2860
|
-
set(target, prop, value) {
|
|
2861
|
-
set(sources.get(prop) ?? add_source(prop, value), value);
|
|
2862
|
-
return Reflect.set(target, prop, value);
|
|
2863
|
-
}
|
|
2864
|
-
}
|
|
2865
|
-
);
|
|
2866
|
-
this.#instance = (options.hydrate ? hydrate : mount)(options.component, {
|
|
2867
|
-
target: options.target,
|
|
2868
|
-
anchor: options.anchor,
|
|
2869
|
-
props,
|
|
2870
|
-
context: options.context,
|
|
2871
|
-
intro: options.intro ?? false,
|
|
2872
|
-
recover: options.recover,
|
|
2873
|
-
transformError: options.transformError
|
|
2874
|
-
});
|
|
2875
|
-
if (!options?.props?.$$host || options.sync === false) {
|
|
2876
|
-
flushSync();
|
|
2877
|
-
}
|
|
2878
|
-
this.#events = props.$$events;
|
|
2879
|
-
for (const key of Object.keys(this.#instance)) {
|
|
2880
|
-
if (key === "$set" || key === "$destroy" || key === "$on") continue;
|
|
2881
|
-
define_property(this, key, {
|
|
2882
|
-
get() {
|
|
2883
|
-
return this.#instance[key];
|
|
2884
|
-
},
|
|
2885
|
-
/** @param {any} value */
|
|
2886
|
-
set(value) {
|
|
2887
|
-
this.#instance[key] = value;
|
|
2888
|
-
},
|
|
2889
|
-
enumerable: true
|
|
2890
|
-
});
|
|
2891
|
-
}
|
|
2892
|
-
this.#instance.$set = /** @param {Record<string, any>} next */
|
|
2893
|
-
(next2) => {
|
|
2894
|
-
Object.assign(props, next2);
|
|
2895
|
-
};
|
|
2896
|
-
this.#instance.$destroy = () => {
|
|
2897
|
-
unmount(this.#instance);
|
|
2898
|
-
};
|
|
2899
|
-
}
|
|
2900
|
-
/** @param {Record<string, any>} props */
|
|
2901
|
-
$set(props) {
|
|
2902
|
-
this.#instance.$set(props);
|
|
2903
|
-
}
|
|
2904
|
-
/**
|
|
2905
|
-
* @param {string} event
|
|
2906
|
-
* @param {(...args: any[]) => any} callback
|
|
2907
|
-
* @returns {any}
|
|
2908
|
-
*/
|
|
2909
|
-
$on(event, callback) {
|
|
2910
|
-
this.#events[event] = this.#events[event] || [];
|
|
2911
|
-
const cb = (...args) => callback.call(this, ...args);
|
|
2912
|
-
this.#events[event].push(cb);
|
|
2913
|
-
return () => {
|
|
2914
|
-
this.#events[event] = this.#events[event].filter(
|
|
2915
|
-
/** @param {any} fn */
|
|
2916
|
-
(fn) => fn !== cb
|
|
2917
|
-
);
|
|
2918
|
-
};
|
|
2919
|
-
}
|
|
2920
|
-
$destroy() {
|
|
2921
|
-
this.#instance.$destroy();
|
|
2922
|
-
}
|
|
2923
|
-
}
|
|
2924
3014
|
const BLOCK_OPEN = `<!--${HYDRATION_START}-->`;
|
|
2925
3015
|
const BLOCK_CLOSE = `<!--${HYDRATION_END}-->`;
|
|
2926
3016
|
const EMPTY_COMMENT = `<!---->`;
|