@sixb/core 0.2.3 → 0.2.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/dist/actions/index.js +28 -28
- package/dist/agents/cancel.d.ts +1 -1
- package/dist/agents/cancel.d.ts.map +1 -1
- package/dist/agents/child-question.d.ts +35 -2
- package/dist/agents/child-question.d.ts.map +1 -1
- package/dist/agents/execution.d.ts +35 -3
- package/dist/agents/execution.d.ts.map +1 -1
- package/dist/agents/ids.d.ts +4 -0
- package/dist/agents/ids.d.ts.map +1 -1
- package/dist/agents/index.d.ts +9 -7
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +59 -33
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/model-loop.d.ts.map +1 -1
- package/dist/agents/queued-turn.d.ts +16 -0
- package/dist/agents/queued-turn.d.ts.map +1 -0
- package/dist/agents/request.d.ts +79 -1
- package/dist/agents/request.d.ts.map +1 -1
- package/dist/agents/run-after-finish.d.ts +10 -0
- package/dist/agents/run-after-finish.d.ts.map +1 -1
- package/dist/agents/run-artifacts.d.ts +0 -38
- package/dist/agents/run-artifacts.d.ts.map +1 -1
- package/dist/agents/run-events.d.ts +6 -1
- package/dist/agents/run-events.d.ts.map +1 -1
- package/dist/agents/run-session-children.d.ts +9 -0
- package/dist/agents/run-session-children.d.ts.map +1 -1
- package/dist/agents/run-session-http.d.ts.map +1 -1
- package/dist/agents/run-session-serve.d.ts.map +1 -1
- package/dist/agents/run-session.d.ts +14 -1
- package/dist/agents/run-session.d.ts.map +1 -1
- package/dist/agents/run-turn.d.ts.map +1 -1
- package/dist/agents/streams/index.d.ts +1 -1
- package/dist/agents/streams/index.d.ts.map +1 -1
- package/dist/agents/streams/index.js +1 -1
- package/dist/agents/streams/internal.js +1 -1
- package/dist/agents/streams/protocol.d.ts +16 -0
- package/dist/agents/streams/protocol.d.ts.map +1 -1
- package/dist/agents/tool-files.d.ts +1 -1
- package/dist/agents/tool-files.d.ts.map +1 -1
- package/dist/agents/tool-input-coercion.d.ts +20 -0
- package/dist/agents/tool-input-coercion.d.ts.map +1 -0
- package/dist/agents/turn-answered.d.ts +7 -0
- package/dist/agents/turn-answered.d.ts.map +1 -0
- package/dist/agents/validation.d.ts +1 -1
- package/dist/agents/validation.d.ts.map +1 -1
- package/dist/artifacts/canvas-display.d.ts +3 -5
- package/dist/artifacts/canvas-display.d.ts.map +1 -1
- package/dist/artifacts/comments.d.ts +14 -3
- package/dist/artifacts/comments.d.ts.map +1 -1
- package/dist/artifacts/document-fill.d.ts +18 -0
- package/dist/artifacts/document-fill.d.ts.map +1 -0
- package/dist/artifacts/errors.d.ts +1 -1
- package/dist/artifacts/errors.d.ts.map +1 -1
- package/dist/artifacts/events.d.ts +3 -2
- package/dist/artifacts/events.d.ts.map +1 -1
- package/dist/artifacts/execution.d.ts +40 -4
- package/dist/artifacts/execution.d.ts.map +1 -1
- package/dist/artifacts/frames/assets.d.ts +8 -1
- package/dist/artifacts/frames/assets.d.ts.map +1 -1
- package/dist/artifacts/frames/document-data.d.ts +98 -0
- package/dist/artifacts/frames/document-data.d.ts.map +1 -0
- package/dist/artifacts/frames/entries.d.ts +12 -7
- package/dist/artifacts/frames/entries.d.ts.map +1 -1
- package/dist/artifacts/frames/index.d.ts +2 -1
- package/dist/artifacts/frames/index.d.ts.map +1 -1
- package/dist/artifacts/frames/index.js +22 -13
- package/dist/artifacts/frames/index.js.map +4 -4
- package/dist/artifacts/frames/kit.d.ts +15 -0
- package/dist/artifacts/frames/kit.d.ts.map +1 -1
- package/dist/artifacts/frames/protocol.d.ts +65 -3
- package/dist/artifacts/frames/protocol.d.ts.map +1 -1
- package/dist/artifacts/frames/runtime.d.ts +32 -5
- package/dist/artifacts/frames/runtime.d.ts.map +1 -1
- package/dist/artifacts/index.d.ts +4 -2
- package/dist/artifacts/index.d.ts.map +1 -1
- package/dist/artifacts/index.js +35 -3
- package/dist/artifacts/index.js.map +3 -3
- package/dist/artifacts/live/blocks.d.ts +62 -0
- package/dist/artifacts/live/blocks.d.ts.map +1 -0
- package/dist/artifacts/live/board.d.ts +6 -0
- package/dist/artifacts/live/board.d.ts.map +1 -1
- package/dist/artifacts/live/document.d.ts +12 -0
- package/dist/artifacts/live/document.d.ts.map +1 -1
- package/dist/artifacts/live/index.d.ts +2 -0
- package/dist/artifacts/live/index.d.ts.map +1 -1
- package/dist/artifacts/live/index.js +148 -44
- package/dist/artifacts/live/index.js.map +3 -3
- package/dist/artifacts/live/page.d.ts +49 -0
- package/dist/artifacts/live/page.d.ts.map +1 -0
- package/dist/artifacts/live/protocol.d.ts +5 -0
- package/dist/artifacts/live/protocol.d.ts.map +1 -1
- package/dist/artifacts/live/server.d.ts +2 -2
- package/dist/artifacts/live/server.d.ts.map +1 -1
- package/dist/artifacts/live/server.js +23 -19
- package/dist/artifacts/live/server.js.map +1 -1
- package/dist/artifacts/live/state.d.ts +4 -1
- package/dist/artifacts/live/state.d.ts.map +1 -1
- package/dist/artifacts/outline.d.ts +16 -0
- package/dist/artifacts/outline.d.ts.map +1 -1
- package/dist/artifacts/paper.d.ts +22 -0
- package/dist/artifacts/paper.d.ts.map +1 -0
- package/dist/artifacts/pdf-job.d.ts +9 -0
- package/dist/artifacts/pdf-job.d.ts.map +1 -0
- package/dist/artifacts/publish/fields.d.ts +25 -0
- package/dist/artifacts/publish/fields.d.ts.map +1 -0
- package/dist/artifacts/publish/index.d.ts +2 -1
- package/dist/artifacts/publish/index.d.ts.map +1 -1
- package/dist/artifacts/publish/index.js +26 -18
- package/dist/artifacts/publish/index.js.map +1 -1
- package/dist/artifacts/publish/merge.d.ts +5 -5
- package/dist/artifacts/publish/merge.d.ts.map +1 -1
- package/dist/artifacts/publish/pdf.d.ts +28 -0
- package/dist/artifacts/publish/pdf.d.ts.map +1 -0
- package/dist/artifacts/publish/previews.d.ts +12 -20
- package/dist/artifacts/publish/previews.d.ts.map +1 -1
- package/dist/artifacts/publish/publish.d.ts.map +1 -1
- package/dist/artifacts/publish/queries.d.ts +6 -1
- package/dist/artifacts/publish/queries.d.ts.map +1 -1
- package/dist/artifacts/publish/query-answers.d.ts +5 -2
- package/dist/artifacts/publish/query-answers.d.ts.map +1 -1
- package/dist/artifacts/publish/validate/document-html.d.ts +24 -0
- package/dist/artifacts/publish/validate/document-html.d.ts.map +1 -0
- package/dist/artifacts/publish/validate/document.d.ts +5 -3
- package/dist/artifacts/publish/validate/document.d.ts.map +1 -1
- package/dist/artifacts/queries.d.ts +16 -2
- package/dist/artifacts/queries.d.ts.map +1 -1
- package/dist/auth/index.js +2 -2
- package/dist/authorization/event-visibility.d.ts.map +1 -1
- package/dist/authorization/index.js +1 -1
- package/dist/blob-storage/index.js +1 -1
- package/dist/bootstrap/index.js +38 -38
- package/dist/{chunk-tqa68kj7.js → chunk-0hkdtwqk.js} +5 -5
- package/dist/{chunk-s5n9617r.js → chunk-0mvjpgvm.js} +5 -5
- package/dist/{chunk-k66rp2hr.js → chunk-1yh6jgtz.js} +1 -1
- package/dist/{chunk-26qet7wh.js → chunk-5t9gm5tt.js} +4 -4
- package/dist/{chunk-a6fjkcne.js → chunk-60662fyv.js} +54 -28
- package/dist/{chunk-a6fjkcne.js.map → chunk-60662fyv.js.map} +7 -6
- package/dist/{chunk-e0hnbb1m.js → chunk-61zptves.js} +1 -1
- package/dist/{chunk-hkaa807g.js → chunk-68hm50qh.js} +3 -3
- package/dist/{chunk-9nsjjd44.js → chunk-8tv3qd65.js} +2 -1
- package/dist/chunk-8tv3qd65.js.map +12 -0
- package/dist/{chunk-fe6r7yhg.js → chunk-92wrka15.js} +1 -1
- package/dist/{chunk-m7b9q5dk.js → chunk-aw1z0gre.js} +4 -4
- package/dist/chunk-az95tsh3.js.map +2 -2
- package/dist/{chunk-4j0sagwv.js → chunk-b4escq4c.js} +62 -14
- package/dist/{chunk-4j0sagwv.js.map → chunk-b4escq4c.js.map} +7 -7
- package/dist/chunk-bqr703h4.js +1799 -0
- package/dist/chunk-bqr703h4.js.map +13 -0
- package/dist/{chunk-eptrvnby.js → chunk-c29729me.js} +42 -3
- package/dist/chunk-c29729me.js.map +12 -0
- package/dist/{chunk-t24yktqr.js → chunk-dvgc56n2.js} +20 -4
- package/dist/{chunk-t24yktqr.js.map → chunk-dvgc56n2.js.map} +5 -5
- package/dist/{chunk-3014rfjz.js → chunk-ewqn51gr.js} +25 -7
- package/dist/{chunk-3014rfjz.js.map → chunk-ewqn51gr.js.map} +3 -3
- package/dist/{chunk-7z5rkf0m.js → chunk-ey1p8w68.js} +175 -5
- package/dist/chunk-ey1p8w68.js.map +13 -0
- package/dist/{chunk-z0t4p2sk.js → chunk-fpf57gca.js} +350 -61
- package/dist/chunk-fpf57gca.js.map +47 -0
- package/dist/{chunk-kv0kvknv.js → chunk-fzae1jpq.js} +7 -7
- package/dist/{chunk-b9qfh2ya.js → chunk-fzbhybya.js} +29 -2
- package/dist/chunk-fzbhybya.js.map +11 -0
- package/dist/{chunk-2by73sm2.js → chunk-gjhrz66x.js} +225 -17
- package/dist/{chunk-2by73sm2.js.map → chunk-gjhrz66x.js.map} +5 -5
- package/dist/chunk-hn2r7z41.js.map +1 -1
- package/dist/{chunk-6gtxshcc.js → chunk-k29n4176.js} +6 -6
- package/dist/{chunk-48c1z8nj.js → chunk-k3jh8gsg.js} +10 -2
- package/dist/chunk-k3jh8gsg.js.map +10 -0
- package/dist/{chunk-w9s23r24.js → chunk-m3qx2pns.js} +751 -93
- package/dist/chunk-m3qx2pns.js.map +34 -0
- package/dist/{chunk-smnt672s.js → chunk-m9ketb51.js} +20 -4
- package/dist/chunk-m9ketb51.js.map +10 -0
- package/dist/chunk-mbwsgjn7.js +40 -0
- package/dist/chunk-mbwsgjn7.js.map +11 -0
- package/dist/{chunk-sysnvjce.js → chunk-naxjka9v.js} +2 -2
- package/dist/{chunk-n4zzaf6q.js → chunk-nxysqbt0.js} +4 -2
- package/dist/chunk-nxysqbt0.js.map +10 -0
- package/dist/{chunk-vzkxqf8h.js → chunk-paxabbqd.js} +49 -5
- package/dist/chunk-paxabbqd.js.map +23 -0
- package/dist/{chunk-8tqnsx3q.js → chunk-pc7kra3k.js} +5 -3
- package/dist/{chunk-8tqnsx3q.js.map → chunk-pc7kra3k.js.map} +3 -3
- package/dist/{chunk-qafng88v.js → chunk-pqvvqc65.js} +4 -4
- package/dist/chunk-pvpq483h.js.map +2 -2
- package/dist/{chunk-mzx71snp.js → chunk-q7g9cqwt.js} +7 -2
- package/dist/{chunk-mzx71snp.js.map → chunk-q7g9cqwt.js.map} +3 -3
- package/dist/{chunk-8t2ynwg0.js → chunk-q8d9p0tb.js} +24 -1
- package/dist/{chunk-8t2ynwg0.js.map → chunk-q8d9p0tb.js.map} +3 -3
- package/dist/{chunk-wa05txmk.js → chunk-qavwr628.js} +49 -5
- package/dist/chunk-qavwr628.js.map +12 -0
- package/dist/{chunk-bkmnd7zq.js → chunk-rg725hry.js} +174 -30
- package/dist/{chunk-bkmnd7zq.js.map → chunk-rg725hry.js.map} +9 -8
- package/dist/{chunk-8p7bze4c.js → chunk-s1mqyqmm.js} +3 -3
- package/dist/{chunk-p351afzm.js → chunk-s5pj68fa.js} +2 -2
- package/dist/{chunk-855w9nvw.js → chunk-vehcr9eb.js} +1 -1
- package/dist/{chunk-qds484t8.js → chunk-vs2s3p8n.js} +932 -21
- package/dist/chunk-vs2s3p8n.js.map +20 -0
- package/dist/chunk-vtjzwymr.js.map +2 -2
- package/dist/{chunk-n68vz95m.js → chunk-wqe9shx2.js} +1 -1
- package/dist/{chunk-0k3r5kb3.js → chunk-xcrnrpfh.js} +1 -1
- package/dist/{chunk-cwdzcv37.js → chunk-xrmbhap8.js} +2 -2
- package/dist/{chunk-cwdzcv37.js.map → chunk-xrmbhap8.js.map} +2 -2
- package/dist/{chunk-f6ahf5gf.js → chunk-xxfj0rr2.js} +20 -5
- package/dist/chunk-xxfj0rr2.js.map +13 -0
- package/dist/{chunk-3hzhcfsv.js → chunk-y8fwm3z2.js} +2 -2
- package/dist/{chunk-3hzhcfsv.js.map → chunk-y8fwm3z2.js.map} +3 -3
- package/dist/{chunk-e9w4mgdh.js → chunk-z1njfqqs.js} +589 -53
- package/dist/{chunk-e9w4mgdh.js.map → chunk-z1njfqqs.js.map} +14 -11
- package/dist/{chunk-yv8hv4wq.js → chunk-z4jqb44a.js} +3 -1
- package/dist/chunk-z4jqb44a.js.map +10 -0
- package/dist/{chunk-s7xqfxs9.js → chunk-zft9bzbc.js} +2 -1
- package/dist/{chunk-s7xqfxs9.js.map → chunk-zft9bzbc.js.map} +3 -3
- package/dist/{chunk-38yvdqzd.js → chunk-zxhym8tr.js} +1 -1
- package/dist/connectors/connection-handles.d.ts +9 -0
- package/dist/connectors/connection-handles.d.ts.map +1 -0
- package/dist/connectors/connections/authorizations.d.ts +9 -0
- package/dist/connectors/connections/authorizations.d.ts.map +1 -1
- package/dist/connectors/connections/events.d.ts +17 -0
- package/dist/connectors/connections/events.d.ts.map +1 -0
- package/dist/connectors/connections/runs.d.ts +3 -0
- package/dist/connectors/connections/runs.d.ts.map +1 -1
- package/dist/connectors/connections/service.d.ts +4 -0
- package/dist/connectors/connections/service.d.ts.map +1 -1
- package/dist/connectors/execution.d.ts +7 -1
- package/dist/connectors/execution.d.ts.map +1 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.d.ts.map +1 -1
- package/dist/connectors/types.d.ts +22 -1
- package/dist/connectors/types.d.ts.map +1 -1
- package/dist/datasets/write.js +1 -1
- package/dist/deploy/index.d.ts +1 -1
- package/dist/deploy/index.d.ts.map +1 -1
- package/dist/deploy/internal.js +3 -2
- package/dist/deploy/internal.js.map +3 -3
- package/dist/deploy/services.d.ts.map +1 -1
- package/dist/deploy/types.d.ts +18 -1
- package/dist/deploy/types.d.ts.map +1 -1
- package/dist/events/definitions.d.ts +4 -0
- package/dist/events/definitions.d.ts.map +1 -1
- package/dist/events/execution.d.ts.map +1 -1
- package/dist/events/index.d.ts +2 -2
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +3 -3
- package/dist/events/outbox-dispatcher.d.ts +7 -0
- package/dist/events/outbox-dispatcher.d.ts.map +1 -1
- package/dist/events/scope.d.ts +1 -0
- package/dist/events/scope.d.ts.map +1 -1
- package/dist/events/scope.js +1 -1
- package/dist/events/selectors/builder.d.ts +9 -1
- package/dist/events/selectors/builder.d.ts.map +1 -1
- package/dist/events/selectors/index.d.ts +2 -2
- package/dist/events/selectors/index.d.ts.map +1 -1
- package/dist/events/selectors/index.js +2 -2
- package/dist/events/selectors/predicate.d.ts.map +1 -1
- package/dist/events/selectors/types.d.ts +18 -3
- package/dist/events/selectors/types.d.ts.map +1 -1
- package/dist/events/types/artifacts.d.ts +7 -1
- package/dist/events/types/artifacts.d.ts.map +1 -1
- package/dist/events/types/connectors.d.ts +32 -0
- package/dist/events/types/connectors.d.ts.map +1 -0
- package/dist/events/types/index.d.ts +3 -1
- package/dist/events/types/index.d.ts.map +1 -1
- package/dist/execution/agent.js +28 -28
- package/dist/execution/authorization.d.ts +5 -0
- package/dist/execution/authorization.d.ts.map +1 -1
- package/dist/execution/primitive.js +28 -28
- package/dist/execution/request.js +29 -29
- package/dist/execution/scopes.d.ts +8 -0
- package/dist/execution/scopes.d.ts.map +1 -1
- package/dist/execution/script.d.ts +7 -0
- package/dist/execution/script.d.ts.map +1 -0
- package/dist/execution/types.d.ts +16 -1
- package/dist/execution/types.d.ts.map +1 -1
- package/dist/http/api-routes.d.ts.map +1 -1
- package/dist/http/index.js +1 -1
- package/dist/index.d.ts +9 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +46 -44
- package/dist/index.js.map +1 -1
- package/dist/lake-storage/index.js +1 -1
- package/dist/lineage/executors.d.ts +1 -1
- package/dist/lineage/executors.d.ts.map +1 -1
- package/dist/maintenance/index.js +1 -1
- package/dist/materialization/event-envelopes.d.ts +3 -3
- package/dist/materialization/event-envelopes.d.ts.map +1 -1
- package/dist/materialization/events.d.ts +6 -0
- package/dist/materialization/events.d.ts.map +1 -1
- package/dist/materialization/index.js +1 -1
- package/dist/materialization/model.d.ts +6 -0
- package/dist/materialization/model.d.ts.map +1 -1
- package/dist/materializer/index.js +13 -13
- package/dist/materializer/projections/replace.d.ts.map +1 -1
- package/dist/materializer/projections/replacement-plan.d.ts +2 -0
- package/dist/materializer/projections/replacement-plan.d.ts.map +1 -1
- package/dist/materializer/shared/normalize.d.ts +1 -0
- package/dist/materializer/shared/normalize.d.ts.map +1 -1
- package/dist/models/execution/index.js +12 -12
- package/dist/models/language-model.d.ts +6 -0
- package/dist/models/language-model.d.ts.map +1 -1
- package/dist/models/tools.d.ts +2 -0
- package/dist/models/tools.d.ts.map +1 -1
- package/dist/objects/index.js +28 -28
- package/dist/objects/query/index.js +12 -12
- package/dist/pipelines/index.js +18 -18
- package/dist/projections/builders.d.ts +7 -1
- package/dist/projections/builders.d.ts.map +1 -1
- package/dist/projections/index.d.ts +1 -1
- package/dist/projections/index.d.ts.map +1 -1
- package/dist/projections/internal.js +13 -13
- package/dist/projections/types.d.ts +10 -0
- package/dist/projections/types.d.ts.map +1 -1
- package/dist/projections/validation.d.ts.map +1 -1
- package/dist/queues/in-memory.d.ts +2 -1
- package/dist/queues/in-memory.d.ts.map +1 -1
- package/dist/queues/index.d.ts +1 -1
- package/dist/queues/index.d.ts.map +1 -1
- package/dist/queues/index.js +1 -1
- package/dist/queues/types.d.ts +40 -13
- package/dist/queues/types.d.ts.map +1 -1
- package/dist/runtime/host.d.ts +13 -0
- package/dist/runtime/host.d.ts.map +1 -1
- package/dist/runtime/internal.d.ts +1 -0
- package/dist/runtime/internal.d.ts.map +1 -1
- package/dist/runtime/internal.js +39 -18
- package/dist/runtime/internal.js.map +4 -3
- package/dist/runtime/resolve-definitions.d.ts +1 -1
- package/dist/runtime/resolve-definitions.d.ts.map +1 -1
- package/dist/runtime/script.d.ts +39 -0
- package/dist/runtime/script.d.ts.map +1 -0
- package/dist/runtime/sixb.d.ts +2 -2
- package/dist/runtime/sixb.d.ts.map +1 -1
- package/dist/schedules/builders.d.ts.map +1 -1
- package/dist/schedules/index.js +3 -3
- package/dist/schedules/runtime.d.ts.map +1 -1
- package/dist/schedules/validation.d.ts +2 -0
- package/dist/schedules/validation.d.ts.map +1 -1
- package/dist/shares/internal.js +12 -12
- package/dist/storage/agents/errors.d.ts +1 -1
- package/dist/storage/agents/errors.d.ts.map +1 -1
- package/dist/storage/agents/in-memory.d.ts +26 -1
- package/dist/storage/agents/in-memory.d.ts.map +1 -1
- package/dist/storage/agents/index.d.ts +2 -2
- package/dist/storage/agents/index.d.ts.map +1 -1
- package/dist/storage/agents/provider.d.ts +12 -3
- package/dist/storage/agents/provider.d.ts.map +1 -1
- package/dist/storage/agents/provider.js +25 -5
- package/dist/storage/agents/provider.js.map +1 -1
- package/dist/storage/agents/types.d.ts +156 -1
- package/dist/storage/agents/types.d.ts.map +1 -1
- package/dist/storage/artifacts/in-memory.d.ts +7 -1
- package/dist/storage/artifacts/in-memory.d.ts.map +1 -1
- package/dist/storage/artifacts/index.d.ts +1 -1
- package/dist/storage/artifacts/index.d.ts.map +1 -1
- package/dist/storage/artifacts/record.d.ts +2 -1
- package/dist/storage/artifacts/record.d.ts.map +1 -1
- package/dist/storage/artifacts/types.d.ts +34 -0
- package/dist/storage/artifacts/types.d.ts.map +1 -1
- package/dist/storage/executions/provider.d.ts +3 -3
- package/dist/storage/executions/provider.d.ts.map +1 -1
- package/dist/storage/executions/provider.js +1 -1
- package/dist/storage/executions/types.d.ts +6 -0
- package/dist/storage/executions/types.d.ts.map +1 -1
- package/dist/storage/executions/validation.d.ts.map +1 -1
- package/dist/storage/file-upload-sessions/provider.js +3 -3
- package/dist/storage/index.d.ts +3 -3
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +18 -14
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/internal.d.ts +1 -1
- package/dist/storage/internal.d.ts.map +1 -1
- package/dist/storage/internal.js +8 -6
- package/dist/storage/internal.js.map +2 -2
- package/dist/storage/ontology/in-memory/replacement-plans.d.ts +2 -0
- package/dist/storage/ontology/in-memory/replacement-plans.d.ts.map +1 -1
- package/dist/storage/ontology/provider.js +1 -1
- package/dist/storage/ontology/replacement-plans.d.ts +8 -0
- package/dist/storage/ontology/replacement-plans.d.ts.map +1 -1
- package/dist/storage/operation-scope.d.ts.map +1 -1
- package/dist/storage/operation-scope.js +1 -1
- package/dist/storage/workflow-runs/provider.js +3 -3
- package/dist/syncs/index.js +19 -19
- package/dist/testing/agent-execution.d.ts +3 -0
- package/dist/testing/agent-execution.d.ts.map +1 -1
- package/dist/testing/agent-inbox-storage-contract.d.ts +15 -0
- package/dist/testing/agent-inbox-storage-contract.d.ts.map +1 -0
- package/dist/testing/agent-storage-contract.d.ts.map +1 -1
- package/dist/testing/artifact-storage-contract.d.ts.map +1 -1
- package/dist/testing/execution-storage-contract.d.ts.map +1 -1
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +5524 -4555
- package/dist/testing/index.js.map +10 -9
- package/dist/testing/materializer-storage-contract.d.ts.map +1 -1
- package/dist/testing/queues-contract.d.ts.map +1 -1
- package/dist/webhooks/connections.d.ts +3 -4
- package/dist/webhooks/connections.d.ts.map +1 -1
- package/dist/webhooks/index.d.ts +1 -1
- package/dist/webhooks/index.d.ts.map +1 -1
- package/dist/webhooks/internal.js +16 -49
- package/dist/webhooks/internal.js.map +3 -3
- package/dist/webhooks/types.d.ts +2 -11
- package/dist/webhooks/types.d.ts.map +1 -1
- package/dist/workers/queued-run-dispatch.d.ts.map +1 -1
- package/dist/workflows/index.js +35 -35
- package/package.json +6 -1
- package/src/agents/README.md +6 -2
- package/src/agents/approval-outcome.ts +2 -2
- package/src/agents/cancel.ts +2 -2
- package/src/agents/child-question.ts +76 -8
- package/src/agents/execution.ts +168 -30
- package/src/agents/ids.ts +9 -1
- package/src/agents/index.ts +27 -6
- package/src/agents/model-loop.ts +3 -1
- package/src/agents/queued-turn.ts +46 -0
- package/src/agents/request.ts +517 -2
- package/src/agents/run-after-finish.ts +259 -2
- package/src/agents/run-artifacts.ts +3 -93
- package/src/agents/run-events.ts +26 -1
- package/src/agents/run-session-children.ts +33 -0
- package/src/agents/run-session-http.ts +10 -2
- package/src/agents/run-session-serve.ts +3 -8
- package/src/agents/run-session.ts +142 -3
- package/src/agents/run-turn.ts +8 -0
- package/src/agents/streams/index.ts +1 -0
- package/src/agents/streams/protocol.ts +41 -1
- package/src/agents/tool-files.ts +1 -1
- package/src/agents/tool-input-coercion.ts +140 -0
- package/src/agents/turn-answered.ts +31 -0
- package/src/agents/validation.ts +13 -3
- package/src/artifacts/canvas-display.ts +4 -6
- package/src/artifacts/comments.ts +70 -17
- package/src/artifacts/document-fill.ts +103 -0
- package/src/artifacts/errors.ts +2 -0
- package/src/artifacts/events.ts +4 -1
- package/src/artifacts/execution.ts +265 -31
- package/src/artifacts/frames/assets.ts +42 -7
- package/src/artifacts/frames/document-data.ts +353 -0
- package/src/artifacts/frames/entries.ts +22 -16
- package/src/artifacts/frames/grants.ts +2 -2
- package/src/artifacts/frames/index.ts +3 -0
- package/src/artifacts/frames/kit.ts +102 -0
- package/src/artifacts/frames/protocol.ts +96 -3
- package/src/artifacts/frames/runtime.ts +709 -19
- package/src/artifacts/index.ts +6 -0
- package/src/artifacts/live/blocks.ts +889 -0
- package/src/artifacts/live/board.ts +195 -42
- package/src/artifacts/live/document.ts +170 -5
- package/src/artifacts/live/index.ts +7 -0
- package/src/artifacts/live/page.ts +807 -0
- package/src/artifacts/live/protocol.ts +5 -0
- package/src/artifacts/live/server.ts +2 -2
- package/src/artifacts/live/state.ts +9 -4
- package/src/artifacts/outline.ts +17 -0
- package/src/artifacts/paper.ts +173 -0
- package/src/artifacts/pdf-job.ts +11 -0
- package/src/artifacts/publish/fields.ts +177 -0
- package/src/artifacts/publish/index.ts +6 -1
- package/src/artifacts/publish/merge.ts +14 -12
- package/src/artifacts/publish/pdf.ts +82 -0
- package/src/artifacts/publish/previews.ts +24 -34
- package/src/artifacts/publish/publish.ts +26 -3
- package/src/artifacts/publish/queries.ts +20 -4
- package/src/artifacts/publish/query-answers.ts +14 -3
- package/src/artifacts/publish/validate/document-html.ts +245 -0
- package/src/artifacts/publish/validate/document.ts +34 -3
- package/src/artifacts/queries.ts +59 -13
- package/src/authorization/event-visibility.ts +13 -0
- package/src/connectors/connection-handles.ts +71 -0
- package/src/connectors/connections/authorizations.ts +50 -2
- package/src/connectors/connections/events.ts +57 -0
- package/src/connectors/connections/runs.ts +5 -0
- package/src/connectors/connections/service.ts +19 -1
- package/src/connectors/execution.ts +30 -2
- package/src/connectors/index.ts +3 -0
- package/src/connectors/types.ts +29 -1
- package/src/deploy/index.ts +1 -0
- package/src/deploy/services.ts +1 -0
- package/src/deploy/types.ts +26 -1
- package/src/events/definitions.ts +14 -0
- package/src/events/execution.ts +9 -2
- package/src/events/index.ts +8 -0
- package/src/events/outbox-dispatcher.ts +12 -2
- package/src/events/scope.ts +3 -0
- package/src/events/selectors/builder.ts +49 -0
- package/src/events/selectors/index.ts +5 -0
- package/src/events/selectors/predicate.ts +2 -0
- package/src/events/selectors/types.ts +30 -1
- package/src/events/types/artifacts.ts +7 -1
- package/src/events/types/connectors.ts +36 -0
- package/src/events/types/index.ts +7 -0
- package/src/execution/authorization.ts +45 -0
- package/src/execution/durable.ts +2 -0
- package/src/execution/scopes.ts +24 -0
- package/src/execution/script.ts +27 -0
- package/src/execution/types.ts +7 -1
- package/src/http/api-routes.ts +26 -1
- package/src/index.ts +21 -2
- package/src/lineage/executors.ts +3 -1
- package/src/materialization/event-envelopes.ts +10 -5
- package/src/materialization/events.ts +2 -0
- package/src/materialization/model.ts +6 -0
- package/src/materializer/README.md +10 -0
- package/src/materializer/projections/replace.ts +42 -1
- package/src/materializer/projections/replacement-plan.ts +44 -4
- package/src/materializer/shared/normalize.ts +4 -0
- package/src/models/language-model.ts +6 -0
- package/src/models/tools.ts +2 -0
- package/src/projections/builders.ts +20 -0
- package/src/projections/index.ts +1 -0
- package/src/projections/registry.ts +1 -0
- package/src/projections/revision.ts +2 -0
- package/src/projections/types.ts +11 -0
- package/src/projections/validation.ts +6 -0
- package/src/queues/in-memory.ts +5 -0
- package/src/queues/index.ts +3 -1
- package/src/queues/types.ts +45 -14
- package/src/runtime/host.ts +112 -4
- package/src/runtime/internal.ts +1 -0
- package/src/runtime/resolve-definitions.ts +4 -1
- package/src/runtime/script.ts +62 -0
- package/src/runtime/sixb.ts +3 -3
- package/src/schedules/builders.ts +4 -1
- package/src/schedules/runtime.ts +3 -0
- package/src/schedules/validation.ts +20 -2
- package/src/storage/agents/errors.ts +1 -0
- package/src/storage/agents/in-memory.ts +229 -1
- package/src/storage/agents/index.ts +16 -0
- package/src/storage/agents/provider.ts +284 -2
- package/src/storage/agents/types.ts +168 -1
- package/src/storage/artifacts/in-memory.ts +32 -1
- package/src/storage/artifacts/index.ts +2 -0
- package/src/storage/artifacts/record.ts +25 -2
- package/src/storage/artifacts/types.ts +37 -0
- package/src/storage/executions/provider.ts +22 -2
- package/src/storage/executions/types.ts +2 -0
- package/src/storage/executions/validation.ts +27 -0
- package/src/storage/index.ts +18 -0
- package/src/storage/internal.ts +1 -0
- package/src/storage/ontology/in-memory/replacement-plans.ts +22 -0
- package/src/storage/ontology/replacement-plans.ts +6 -0
- package/src/storage/operation-scope.ts +1 -0
- package/src/testing/agent-execution.ts +45 -2
- package/src/testing/agent-inbox-storage-contract.ts +815 -0
- package/src/testing/agent-storage-contract.ts +103 -0
- package/src/testing/artifact-storage-contract.ts +72 -4
- package/src/testing/execution-storage-contract.ts +31 -0
- package/src/testing/index.ts +5 -0
- package/src/testing/materializer-storage-contract.ts +139 -1
- package/src/testing/queues-contract.ts +22 -0
- package/src/webhooks/connections.ts +9 -50
- package/src/webhooks/index.ts +0 -2
- package/src/webhooks/types.ts +2 -13
- package/src/workers/queued-run-dispatch.ts +8 -1
- package/dist/chunk-48c1z8nj.js.map +0 -10
- package/dist/chunk-58geavnf.js +0 -29
- package/dist/chunk-58geavnf.js.map +0 -10
- package/dist/chunk-7z5rkf0m.js.map +0 -13
- package/dist/chunk-9nsjjd44.js.map +0 -12
- package/dist/chunk-b9qfh2ya.js.map +0 -11
- package/dist/chunk-eptrvnby.js.map +0 -12
- package/dist/chunk-f6ahf5gf.js.map +0 -13
- package/dist/chunk-m2jerfef.js +0 -474
- package/dist/chunk-m2jerfef.js.map +0 -11
- package/dist/chunk-n4zzaf6q.js.map +0 -10
- package/dist/chunk-qds484t8.js.map +0 -18
- package/dist/chunk-smnt672s.js.map +0 -10
- package/dist/chunk-vzkxqf8h.js.map +0 -23
- package/dist/chunk-w9s23r24.js.map +0 -30
- package/dist/chunk-wa05txmk.js.map +0 -11
- package/dist/chunk-yv8hv4wq.js.map +0 -10
- package/dist/chunk-z0t4p2sk.js.map +0 -47
- /package/dist/{chunk-tqa68kj7.js.map → chunk-0hkdtwqk.js.map} +0 -0
- /package/dist/{chunk-s5n9617r.js.map → chunk-0mvjpgvm.js.map} +0 -0
- /package/dist/{chunk-k66rp2hr.js.map → chunk-1yh6jgtz.js.map} +0 -0
- /package/dist/{chunk-26qet7wh.js.map → chunk-5t9gm5tt.js.map} +0 -0
- /package/dist/{chunk-e0hnbb1m.js.map → chunk-61zptves.js.map} +0 -0
- /package/dist/{chunk-hkaa807g.js.map → chunk-68hm50qh.js.map} +0 -0
- /package/dist/{chunk-fe6r7yhg.js.map → chunk-92wrka15.js.map} +0 -0
- /package/dist/{chunk-m7b9q5dk.js.map → chunk-aw1z0gre.js.map} +0 -0
- /package/dist/{chunk-kv0kvknv.js.map → chunk-fzae1jpq.js.map} +0 -0
- /package/dist/{chunk-6gtxshcc.js.map → chunk-k29n4176.js.map} +0 -0
- /package/dist/{chunk-sysnvjce.js.map → chunk-naxjka9v.js.map} +0 -0
- /package/dist/{chunk-qafng88v.js.map → chunk-pqvvqc65.js.map} +0 -0
- /package/dist/{chunk-8p7bze4c.js.map → chunk-s1mqyqmm.js.map} +0 -0
- /package/dist/{chunk-p351afzm.js.map → chunk-s5pj68fa.js.map} +0 -0
- /package/dist/{chunk-855w9nvw.js.map → chunk-vehcr9eb.js.map} +0 -0
- /package/dist/{chunk-n68vz95m.js.map → chunk-wqe9shx2.js.map} +0 -0
- /package/dist/{chunk-0k3r5kb3.js.map → chunk-xcrnrpfh.js.map} +0 -0
- /package/dist/{chunk-38yvdqzd.js.map → chunk-zxhym8tr.js.map} +0 -0
|
@@ -25,6 +25,295 @@ class ArtifactRequestError2 extends Error {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
// src/artifacts/document-fill.ts
|
|
29
|
+
import {
|
|
30
|
+
defaultTreeAdapter as adapter,
|
|
31
|
+
parse,
|
|
32
|
+
serialize
|
|
33
|
+
} from "parse5";
|
|
34
|
+
|
|
35
|
+
// src/artifacts/frames/document-data.ts
|
|
36
|
+
function documentData() {
|
|
37
|
+
const FIELD = "data-sixb-field";
|
|
38
|
+
const EACH = "data-sixb-each";
|
|
39
|
+
const FORMAT = "data-format";
|
|
40
|
+
const CURRENCY = "data-currency";
|
|
41
|
+
const CURRENCY_FIELD = "data-currency-field";
|
|
42
|
+
const LOCKED = "data-sixb-locked";
|
|
43
|
+
const EMPTY = "data-sixb-empty";
|
|
44
|
+
const QUERY = /^query:([a-z0-9][a-z0-9-]{0,63})(?:\.(.*))?$/;
|
|
45
|
+
const STEP = /^([A-Za-z_][\w-]*)(?:\[([^\]]+)\])?$/;
|
|
46
|
+
const UNREAD = Symbol("unread");
|
|
47
|
+
const HIDDEN = Symbol("hidden");
|
|
48
|
+
const parse = (path) => {
|
|
49
|
+
const query = QUERY.exec(path.trim());
|
|
50
|
+
const rest = query ? query[2] ?? "" : path.trim();
|
|
51
|
+
const steps = [];
|
|
52
|
+
for (const part of rest === "" ? [] : rest.split(".")) {
|
|
53
|
+
const step = STEP.exec(part);
|
|
54
|
+
if (!step?.[1])
|
|
55
|
+
return null;
|
|
56
|
+
steps.push(step[2] === undefined ? { key: step[1] } : { key: step[1], id: step[2] });
|
|
57
|
+
}
|
|
58
|
+
if (!query && steps.length === 0)
|
|
59
|
+
return null;
|
|
60
|
+
return query?.[1] ? { query: query[1], steps } : { steps };
|
|
61
|
+
};
|
|
62
|
+
const isRow = (value) => typeof value === "object" && value !== null && ("properties" in value) && typeof value.properties === "object";
|
|
63
|
+
const step = (value, next) => {
|
|
64
|
+
if (Array.isArray(value))
|
|
65
|
+
return value.length > 0 ? step(value[0], next) : undefined;
|
|
66
|
+
let found;
|
|
67
|
+
if (isRow(value)) {
|
|
68
|
+
if (Object.hasOwn(value.properties, next.key))
|
|
69
|
+
found = value.properties[next.key];
|
|
70
|
+
else if (value.redactions && Object.hasOwn(value.redactions, next.key))
|
|
71
|
+
return HIDDEN;
|
|
72
|
+
else
|
|
73
|
+
found = value.links?.[next.key];
|
|
74
|
+
} else if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
75
|
+
found = value[next.key];
|
|
76
|
+
}
|
|
77
|
+
if (next.id === undefined)
|
|
78
|
+
return found;
|
|
79
|
+
if (!Array.isArray(found))
|
|
80
|
+
return;
|
|
81
|
+
return found.find((item) => isRow(item) ? item.primaryId === next.id || item.properties.id === next.id : typeof item === "object" && item !== null && item.id === next.id);
|
|
82
|
+
};
|
|
83
|
+
const read = (path, scope) => {
|
|
84
|
+
let value;
|
|
85
|
+
if (path.query !== undefined) {
|
|
86
|
+
const result = scope.sources.queries[path.query];
|
|
87
|
+
if (!result)
|
|
88
|
+
return UNREAD;
|
|
89
|
+
const [first, second] = path.steps;
|
|
90
|
+
if (first?.key === "total" && path.steps.length === 1)
|
|
91
|
+
return result.total;
|
|
92
|
+
if (first?.key === "facets" && second && path.steps.length === 2) {
|
|
93
|
+
return result.facets?.find((facet) => facet.propertyId === second.key)?.buckets;
|
|
94
|
+
}
|
|
95
|
+
if (path.steps.length === 0)
|
|
96
|
+
return result.objects ?? [];
|
|
97
|
+
value = result.objects;
|
|
98
|
+
} else if (scope.item !== undefined) {
|
|
99
|
+
value = scope.item;
|
|
100
|
+
} else {
|
|
101
|
+
if (!scope.sources.holder)
|
|
102
|
+
return UNREAD;
|
|
103
|
+
value = scope.sources.holder;
|
|
104
|
+
}
|
|
105
|
+
for (const next of path.steps) {
|
|
106
|
+
if (value === HIDDEN)
|
|
107
|
+
return HIDDEN;
|
|
108
|
+
value = step(value, next);
|
|
109
|
+
}
|
|
110
|
+
return value;
|
|
111
|
+
};
|
|
112
|
+
const format = (value, as, currency, lang) => {
|
|
113
|
+
if (value === null || value === undefined)
|
|
114
|
+
return "";
|
|
115
|
+
const number = typeof value === "number" ? value : typeof value === "string" && value.trim() !== "" ? Number(value) : Number.NaN;
|
|
116
|
+
try {
|
|
117
|
+
if (as === "money" && Number.isFinite(number)) {
|
|
118
|
+
const cents = Number.isInteger(number) ? { minimumFractionDigits: 0 } : {};
|
|
119
|
+
return currency ? new Intl.NumberFormat(lang, { style: "currency", currency, ...cents }).format(number) : new Intl.NumberFormat(lang, {
|
|
120
|
+
minimumFractionDigits: 2,
|
|
121
|
+
maximumFractionDigits: 2,
|
|
122
|
+
...cents
|
|
123
|
+
}).format(number);
|
|
124
|
+
}
|
|
125
|
+
if (as === "number" && Number.isFinite(number)) {
|
|
126
|
+
return new Intl.NumberFormat(lang).format(number);
|
|
127
|
+
}
|
|
128
|
+
if (as === "percent" && Number.isFinite(number)) {
|
|
129
|
+
return new Intl.NumberFormat(lang, { style: "percent", maximumFractionDigits: 2 }).format(number);
|
|
130
|
+
}
|
|
131
|
+
if (as === "date") {
|
|
132
|
+
const date = new Date(String(value));
|
|
133
|
+
if (!Number.isNaN(date.getTime())) {
|
|
134
|
+
return new Intl.DateTimeFormat(lang, { dateStyle: "long", timeZone: "UTC" }).format(date);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
} catch {}
|
|
138
|
+
if (Array.isArray(value)) {
|
|
139
|
+
return value.filter((each) => typeof each !== "object" || each === null).map(String).join(", ");
|
|
140
|
+
}
|
|
141
|
+
return typeof value === "object" ? "" : String(value);
|
|
142
|
+
};
|
|
143
|
+
const fill = (root, tree, options) => {
|
|
144
|
+
const lang = options.lang || "en";
|
|
145
|
+
const visit = (node, scope) => {
|
|
146
|
+
const children = tree.children(node);
|
|
147
|
+
for (let index = 0;index < children.length; index += 1) {
|
|
148
|
+
const child = children[index];
|
|
149
|
+
const each = tree.attribute(child, EACH);
|
|
150
|
+
if (each !== null) {
|
|
151
|
+
const written = [child];
|
|
152
|
+
while (index + 1 < children.length) {
|
|
153
|
+
const next = children[index + 1];
|
|
154
|
+
if (tree.attribute(next, EACH) !== each)
|
|
155
|
+
break;
|
|
156
|
+
written.push(next);
|
|
157
|
+
index += 1;
|
|
158
|
+
}
|
|
159
|
+
const path = parse(each);
|
|
160
|
+
const items = path ? read(path, scope) : UNREAD;
|
|
161
|
+
if (items === UNREAD || items === HIDDEN) {
|
|
162
|
+
if (options.plain)
|
|
163
|
+
for (const copy of written)
|
|
164
|
+
unmark(copy);
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
const list = Array.isArray(items) ? items : items == null ? [] : [items];
|
|
168
|
+
const copies = list.map((item) => {
|
|
169
|
+
const copy = tree.clone(child);
|
|
170
|
+
if (!options.keep)
|
|
171
|
+
tree.removeAttribute(copy, EACH);
|
|
172
|
+
tree.removeAttribute(copy, EMPTY);
|
|
173
|
+
visit(copy, { sources: scope.sources, item });
|
|
174
|
+
return copy;
|
|
175
|
+
});
|
|
176
|
+
for (const copy of written.slice(1))
|
|
177
|
+
tree.replace(copy, []);
|
|
178
|
+
if (options.keep && copies.length === 0) {
|
|
179
|
+
tree.setAttribute(child, EMPTY, "");
|
|
180
|
+
} else {
|
|
181
|
+
tree.replace(child, copies);
|
|
182
|
+
}
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
const field = tree.attribute(child, FIELD);
|
|
186
|
+
if (field === null) {
|
|
187
|
+
visit(child, scope);
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
const path = parse(field);
|
|
191
|
+
const value = path ? read(path, scope) : UNREAD;
|
|
192
|
+
const currencyField = tree.attribute(child, CURRENCY_FIELD);
|
|
193
|
+
const currencyPath = currencyField === null ? null : parse(currencyField);
|
|
194
|
+
const currency = currencyPath ? read(currencyPath, scope) : tree.attribute(child, CURRENCY);
|
|
195
|
+
if (options.plain)
|
|
196
|
+
unmark(child);
|
|
197
|
+
if (value === UNREAD)
|
|
198
|
+
continue;
|
|
199
|
+
if (value === HIDDEN) {
|
|
200
|
+
tree.setText(child, "\u2022\u2022\u2022");
|
|
201
|
+
if (!options.plain && !options.keep)
|
|
202
|
+
tree.setAttribute(child, LOCKED, "");
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
tree.setText(child, format(value, tree.attribute(child, FORMAT), typeof currency === "string" && currency !== "" ? currency : null, lang));
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
const unmark = (node) => {
|
|
209
|
+
if (tree.attribute(node, EMPTY) !== null)
|
|
210
|
+
return tree.replace(node, []);
|
|
211
|
+
for (const name of [FIELD, EACH, CURRENCY_FIELD])
|
|
212
|
+
tree.removeAttribute(node, name);
|
|
213
|
+
for (const child of tree.children(node))
|
|
214
|
+
unmark(child);
|
|
215
|
+
};
|
|
216
|
+
visit(root, { sources: options.sources });
|
|
217
|
+
};
|
|
218
|
+
const marks = (root, tree) => {
|
|
219
|
+
const found = [];
|
|
220
|
+
const visit = (node, within) => {
|
|
221
|
+
for (const child of tree.children(node)) {
|
|
222
|
+
const each = tree.attribute(child, EACH);
|
|
223
|
+
const field = tree.attribute(child, FIELD);
|
|
224
|
+
if (each !== null)
|
|
225
|
+
found.push({ kind: "each", path: each, within });
|
|
226
|
+
if (field !== null)
|
|
227
|
+
found.push({ kind: "field", path: field, within });
|
|
228
|
+
const currency = tree.attribute(child, CURRENCY_FIELD);
|
|
229
|
+
if (currency !== null)
|
|
230
|
+
found.push({ kind: "field", path: currency, within });
|
|
231
|
+
visit(child, each === null ? within : [...within, each]);
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
visit(root, []);
|
|
235
|
+
return found;
|
|
236
|
+
};
|
|
237
|
+
const reads = (found) => {
|
|
238
|
+
const queries = new Set;
|
|
239
|
+
let holder = false;
|
|
240
|
+
for (const mark of found) {
|
|
241
|
+
const named = [...mark.within, mark.path].map(parse).find((path) => path?.query);
|
|
242
|
+
if (named?.query)
|
|
243
|
+
queries.add(named.query);
|
|
244
|
+
else
|
|
245
|
+
holder = true;
|
|
246
|
+
}
|
|
247
|
+
return { holder, queries: [...queries] };
|
|
248
|
+
};
|
|
249
|
+
return { parse, fill, marks, reads };
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// src/artifacts/document-fill.ts
|
|
253
|
+
var isElement = (node) => ("tagName" in node);
|
|
254
|
+
var tree = {
|
|
255
|
+
children: (node) => node.childNodes.filter(isElement),
|
|
256
|
+
attribute: (node, name) => node.attrs.find((each) => each.name === name)?.value ?? null,
|
|
257
|
+
setAttribute(node, name, value) {
|
|
258
|
+
const found = node.attrs.find((each) => each.name === name);
|
|
259
|
+
if (found)
|
|
260
|
+
found.value = value;
|
|
261
|
+
else
|
|
262
|
+
node.attrs.push({ name, value });
|
|
263
|
+
},
|
|
264
|
+
removeAttribute(node, name) {
|
|
265
|
+
node.attrs = node.attrs.filter((each) => each.name !== name);
|
|
266
|
+
},
|
|
267
|
+
setText(node, text) {
|
|
268
|
+
for (const child of [...node.childNodes])
|
|
269
|
+
adapter.detachNode(child);
|
|
270
|
+
adapter.insertText(node, text);
|
|
271
|
+
},
|
|
272
|
+
clone: (node) => copy(node),
|
|
273
|
+
replace(node, nodes) {
|
|
274
|
+
const parent = node.parentNode;
|
|
275
|
+
if (!parent)
|
|
276
|
+
return;
|
|
277
|
+
for (const each of nodes)
|
|
278
|
+
adapter.insertBefore(parent, each, node);
|
|
279
|
+
adapter.detachNode(node);
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
function copy(node) {
|
|
283
|
+
if (!isElement(node))
|
|
284
|
+
return { ...node, parentNode: null };
|
|
285
|
+
const element = adapter.createElement(node.tagName, node.namespaceURI, node.attrs.map((each) => ({ ...each })));
|
|
286
|
+
for (const child of node.childNodes)
|
|
287
|
+
adapter.appendChild(element, copy(child));
|
|
288
|
+
return element;
|
|
289
|
+
}
|
|
290
|
+
function bodyOf(html) {
|
|
291
|
+
const document2 = parse(html);
|
|
292
|
+
const root = document2.childNodes.find(isElement);
|
|
293
|
+
const body = root?.childNodes.find((child) => isElement(child) && child.tagName === "body");
|
|
294
|
+
return { document: document2, root, body };
|
|
295
|
+
}
|
|
296
|
+
function documentMarks(html) {
|
|
297
|
+
const { body } = bodyOf(html);
|
|
298
|
+
return body ? documentData().marks(body, tree) : [];
|
|
299
|
+
}
|
|
300
|
+
function fillDocumentHtml(html, sources, options = {}) {
|
|
301
|
+
const { document: document2, root, body } = bodyOf(html);
|
|
302
|
+
if (!body || documentData().marks(body, tree).length === 0)
|
|
303
|
+
return html;
|
|
304
|
+
const lang = root ? tree.attribute(root, "lang") ?? undefined : undefined;
|
|
305
|
+
documentData().fill(body, tree, {
|
|
306
|
+
sources,
|
|
307
|
+
...lang ? { lang } : {},
|
|
308
|
+
...options.plain ? { plain: true } : {},
|
|
309
|
+
...options.keep ? { keep: true } : {}
|
|
310
|
+
});
|
|
311
|
+
return serialize(document2);
|
|
312
|
+
}
|
|
313
|
+
function frozenDocumentHtml2(html) {
|
|
314
|
+
return fillDocumentHtml(html, { queries: {} }, { plain: true });
|
|
315
|
+
}
|
|
316
|
+
|
|
28
317
|
// src/artifacts/publish/files.ts
|
|
29
318
|
async function checkArtifactFiles(blobStorage, files) {
|
|
30
319
|
if (files.length === 0)
|
|
@@ -683,10 +972,98 @@ var FRAME_PAGE_CSS = kit(` html { color-scheme: light; }
|
|
|
683
972
|
}
|
|
684
973
|
img[data-sixb-ref="unavailable"] { display: block; min-width: 120px; min-height: 68px; border-radius: var(--radius); background: var(--muted); }
|
|
685
974
|
`);
|
|
975
|
+
var FRAME_DOCUMENT_CSS = kit(` :root {
|
|
976
|
+
--sixb-stage: ${LIGHT["--muted"]};
|
|
977
|
+
--sixb-stage-border: ${LIGHT["--border"]};
|
|
978
|
+
--sixb-paper-width: 816px;
|
|
979
|
+
--sixb-paper-margin-top: 72px;
|
|
980
|
+
--sixb-paper-margin-right: 72px;
|
|
981
|
+
--sixb-paper-margin-bottom: 72px;
|
|
982
|
+
--sixb-paper-margin-left: 72px;
|
|
983
|
+
}
|
|
984
|
+
html { color-scheme: light; background: var(--sixb-stage); }
|
|
985
|
+
body {
|
|
986
|
+
width: 100%;
|
|
987
|
+
max-width: var(--sixb-paper-width);
|
|
988
|
+
min-height: calc(100vh - 64px);
|
|
989
|
+
margin: 32px auto;
|
|
990
|
+
padding: var(--sixb-paper-margin-top) var(--sixb-paper-margin-right) var(--sixb-paper-margin-bottom) var(--sixb-paper-margin-left);
|
|
991
|
+
background: #fff;
|
|
992
|
+
color: #18181b;
|
|
993
|
+
box-shadow: 0 0 0 1px var(--sixb-stage-border);
|
|
994
|
+
}
|
|
995
|
+
@media (max-width: 720px) {
|
|
996
|
+
body { min-height: 100vh; margin: 0; padding: 28px 20px; box-shadow: none; }
|
|
997
|
+
}
|
|
998
|
+
img, svg { max-width: 100%; }
|
|
999
|
+
/* A page break, as one sheet: the stage shows through, from edge to edge of the sheet. */
|
|
1000
|
+
.sixb-page-break {
|
|
1001
|
+
display: block;
|
|
1002
|
+
height: 24px;
|
|
1003
|
+
margin: var(--sixb-paper-margin-bottom) calc(-1 * var(--sixb-paper-margin-right)) var(--sixb-paper-margin-top) calc(-1 * var(--sixb-paper-margin-left));
|
|
1004
|
+
background: var(--sixb-stage);
|
|
1005
|
+
box-shadow: inset 0 1px 0 var(--sixb-stage-border), inset 0 -1px 0 var(--sixb-stage-border);
|
|
1006
|
+
}
|
|
1007
|
+
@media (max-width: 720px) {
|
|
1008
|
+
.sixb-page-break { height: 0; margin: 32px 0; box-shadow: inset 0 1px 0 var(--sixb-stage-border); }
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
html.sixb-pages, html.sixb-pages body { min-height: 0 !important; }
|
|
1012
|
+
html.sixb-pages body {
|
|
1013
|
+
width: auto !important;
|
|
1014
|
+
max-width: none !important;
|
|
1015
|
+
margin: 0 !important;
|
|
1016
|
+
padding: 24px 16px !important;
|
|
1017
|
+
background: var(--sixb-stage) !important;
|
|
1018
|
+
box-shadow: none !important;
|
|
1019
|
+
border: 0 !important;
|
|
1020
|
+
}
|
|
1021
|
+
/* Until the content is cut into pages, it shows as nothing: never as one long column. */
|
|
1022
|
+
html.sixb-pages:not([data-sixb-pages]) body { visibility: hidden !important; }
|
|
1023
|
+
.sixb-pages, .sixb-paper, .sixb-paper-content, .sixb-flow {
|
|
1024
|
+
box-sizing: content-box !important;
|
|
1025
|
+
max-width: none !important;
|
|
1026
|
+
margin: 0 !important;
|
|
1027
|
+
padding: 0 !important;
|
|
1028
|
+
border: 0 !important;
|
|
1029
|
+
}
|
|
1030
|
+
.sixb-pages {
|
|
1031
|
+
display: flex !important;
|
|
1032
|
+
flex-direction: column !important;
|
|
1033
|
+
align-items: center !important;
|
|
1034
|
+
gap: 24px !important;
|
|
1035
|
+
width: auto !important;
|
|
1036
|
+
zoom: var(--sixb-zoom, 1);
|
|
1037
|
+
}
|
|
1038
|
+
.sixb-paper {
|
|
1039
|
+
position: relative !important;
|
|
1040
|
+
flex: none !important;
|
|
1041
|
+
width: var(--sixb-paper-width) !important;
|
|
1042
|
+
height: var(--sixb-paper-height) !important;
|
|
1043
|
+
overflow: hidden !important;
|
|
1044
|
+
background: #fff;
|
|
1045
|
+
box-shadow: 0 0 0 1px var(--sixb-stage-border), 0 1px 3px rgb(0 0 0 / 0.06);
|
|
1046
|
+
}
|
|
1047
|
+
.sixb-paper-content {
|
|
1048
|
+
position: absolute !important;
|
|
1049
|
+
inset: var(--sixb-paper-margin-top) var(--sixb-paper-margin-right) var(--sixb-paper-margin-bottom) var(--sixb-paper-margin-left) !important;
|
|
1050
|
+
width: auto !important;
|
|
1051
|
+
height: auto !important;
|
|
1052
|
+
overflow: hidden !important;
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
/* Printed, the sheet is the paper: its @page rule gives the margins, and nothing is the stage. */
|
|
1056
|
+
@media print {
|
|
1057
|
+
html { background: none; }
|
|
1058
|
+
body { width: auto; max-width: none; min-height: 0; margin: 0; padding: 0; background: none; box-shadow: none; }
|
|
1059
|
+
.sixb-page-break { display: none; }
|
|
1060
|
+
}
|
|
1061
|
+
`);
|
|
686
1062
|
|
|
687
1063
|
// src/artifacts/frames/runtime.ts
|
|
688
|
-
function frameRuntime() {
|
|
1064
|
+
function frameRuntime(data) {
|
|
689
1065
|
const PROTOCOL = "sixb-frame/1";
|
|
1066
|
+
const EDITOR_GLOBAL = "__sixbFrameEditor";
|
|
690
1067
|
const WIDTH = 1280;
|
|
691
1068
|
const HEIGHT = 720;
|
|
692
1069
|
const KEYS = [
|
|
@@ -718,14 +1095,34 @@ function frameRuntime() {
|
|
|
718
1095
|
"[data-sixb-commenting] [data-sixb-hover] { outline: 2px dashed #0a84ff; outline-offset: 3px; }",
|
|
719
1096
|
"[data-sixb-commenting] [data-sixb-picked] { outline: 2px solid #0a84ff; outline-offset: 3px; }"
|
|
720
1097
|
].join(" ");
|
|
1098
|
+
const CANVAS_CSS = "html { overscroll-behavior: none; } html, html * { touch-action: none !important; }";
|
|
721
1099
|
const root = document.documentElement;
|
|
722
1100
|
const script = document.currentScript;
|
|
723
|
-
const
|
|
1101
|
+
const layout = script?.getAttribute("data-sixb-layout") ?? "deck";
|
|
1102
|
+
const deck = layout === "deck";
|
|
1103
|
+
const designed = layout === "document";
|
|
724
1104
|
const start = new URLSearchParams(window.location.hash.slice(1));
|
|
725
1105
|
if (deck) {
|
|
726
1106
|
root.classList.add("sixb-deck");
|
|
727
1107
|
root.dataset.mode = start.has("sixb-fill") ? "fill" : "slide";
|
|
728
1108
|
}
|
|
1109
|
+
const paper = (script?.getAttribute("data-sixb-paper") ?? "").split(" ").map(Number).filter((value) => Number.isFinite(value) && value >= 0);
|
|
1110
|
+
const hasPaper = paper.length === 6 && (paper[0] ?? 0) > 0 && (paper[1] ?? 0) > 0;
|
|
1111
|
+
const paged = designed && hasPaper && start.has("sixb-pages");
|
|
1112
|
+
if (designed) {
|
|
1113
|
+
root.classList.add("sixb-document");
|
|
1114
|
+
if (hasPaper) {
|
|
1115
|
+
const [width, height, top, right, bottom, left] = paper;
|
|
1116
|
+
root.style.setProperty("--sixb-paper-width", `${width}px`);
|
|
1117
|
+
root.style.setProperty("--sixb-paper-height", `${height}px`);
|
|
1118
|
+
root.style.setProperty("--sixb-paper-margin-top", `${top}px`);
|
|
1119
|
+
root.style.setProperty("--sixb-paper-margin-right", `${right}px`);
|
|
1120
|
+
root.style.setProperty("--sixb-paper-margin-bottom", `${bottom}px`);
|
|
1121
|
+
root.style.setProperty("--sixb-paper-margin-left", `${left}px`);
|
|
1122
|
+
}
|
|
1123
|
+
if (paged)
|
|
1124
|
+
root.classList.add("sixb-pages");
|
|
1125
|
+
}
|
|
729
1126
|
let current = Number(start.get("sixb-slide")) || 1;
|
|
730
1127
|
const slides = () => Array.from(document.querySelectorAll("section.slide"));
|
|
731
1128
|
const post = (message) => window.parent.postMessage({ protocol: PROTOCOL, ...message }, "*");
|
|
@@ -769,7 +1166,7 @@ function frameRuntime() {
|
|
|
769
1166
|
const embeds = Array.from(scope?.querySelectorAll("sixb-embed[src]") ?? []).flatMap((element) => {
|
|
770
1167
|
const id = idOf(element);
|
|
771
1168
|
const rect = element.getBoundingClientRect();
|
|
772
|
-
return near(rect) ? [
|
|
1169
|
+
return near(rect) && (!paged || shownOnItsPage(element)) ? [
|
|
773
1170
|
{
|
|
774
1171
|
id,
|
|
775
1172
|
address: (element.getAttribute("src") ?? "").trim(),
|
|
@@ -785,6 +1182,160 @@ function frameRuntime() {
|
|
|
785
1182
|
post({ event: "embeds", params: { embeds } });
|
|
786
1183
|
});
|
|
787
1184
|
};
|
|
1185
|
+
const PAGE_BREAKS = ["page", "left", "right", "recto", "verso"];
|
|
1186
|
+
const COLUMN_GAP = 64;
|
|
1187
|
+
const shownOnItsPage = (element) => {
|
|
1188
|
+
const box = element.closest(".sixb-paper-content");
|
|
1189
|
+
if (!box)
|
|
1190
|
+
return true;
|
|
1191
|
+
const rect = element.getBoundingClientRect();
|
|
1192
|
+
const page = box.getBoundingClientRect();
|
|
1193
|
+
return rect.right > page.left && rect.left < page.right && rect.bottom > page.top && rect.top < page.bottom;
|
|
1194
|
+
};
|
|
1195
|
+
const NEAR_PAGES = 1;
|
|
1196
|
+
let flow = null;
|
|
1197
|
+
let stride = 0;
|
|
1198
|
+
let sheetsInView = null;
|
|
1199
|
+
const pageCopy = (index) => {
|
|
1200
|
+
if (index === 0 || !flow)
|
|
1201
|
+
return flow;
|
|
1202
|
+
const content = document.querySelector(`.sixb-paper[data-page="${index + 1}"] > div`);
|
|
1203
|
+
if (!content)
|
|
1204
|
+
return null;
|
|
1205
|
+
if (content.firstElementChild)
|
|
1206
|
+
return content.firstElementChild;
|
|
1207
|
+
const copy = flow.cloneNode(true);
|
|
1208
|
+
copy.style.transform = `translateX(${-index * stride}px)`;
|
|
1209
|
+
copy.setAttribute("aria-hidden", "true");
|
|
1210
|
+
copy.inert = true;
|
|
1211
|
+
content.append(copy);
|
|
1212
|
+
return copy;
|
|
1213
|
+
};
|
|
1214
|
+
const shownCopy = (selector) => {
|
|
1215
|
+
const found = (flow ?? document).querySelector(selector);
|
|
1216
|
+
if (!found || !flow)
|
|
1217
|
+
return found;
|
|
1218
|
+
const box = flow.getBoundingClientRect();
|
|
1219
|
+
const scale = box.width / flow.offsetWidth || 1;
|
|
1220
|
+
const left = (found.getClientRects()[0] ?? found.getBoundingClientRect()).left;
|
|
1221
|
+
const copy = pageCopy(Math.max(0, Math.floor((left - box.left) / scale / stride)));
|
|
1222
|
+
if (!copy || copy === flow)
|
|
1223
|
+
return found;
|
|
1224
|
+
const path = [];
|
|
1225
|
+
for (let at = found;at !== flow && at.parentElement; at = at.parentElement) {
|
|
1226
|
+
path.unshift(Array.prototype.indexOf.call(at.parentElement.children, at));
|
|
1227
|
+
}
|
|
1228
|
+
return path.reduce((node, index) => node?.children[index], copy) ?? found;
|
|
1229
|
+
};
|
|
1230
|
+
const fitPages = () => {
|
|
1231
|
+
const width = paper[0] ?? 0;
|
|
1232
|
+
const room = window.innerWidth - 32;
|
|
1233
|
+
root.style.setProperty("--sixb-zoom", String(width > room ? Math.max(0.2, room / width) : 1));
|
|
1234
|
+
};
|
|
1235
|
+
const paginate = () => {
|
|
1236
|
+
sheetsInView?.disconnect();
|
|
1237
|
+
const body = document.body;
|
|
1238
|
+
const [width = 0, height = 0, top = 0, right = 0, bottom = 0, left = 0] = paper;
|
|
1239
|
+
const contentWidth = Math.max(1, width - left - right);
|
|
1240
|
+
const contentHeight = Math.max(1, height - top - bottom);
|
|
1241
|
+
const cut = document.createElement("div");
|
|
1242
|
+
cut.className = "sixb-flow";
|
|
1243
|
+
cut.style.cssText = `width:${contentWidth}px;height:${contentHeight}px;column-width:${contentWidth}px;column-gap:${COLUMN_GAP}px;column-fill:auto;`;
|
|
1244
|
+
cut.append(...Array.from(body.childNodes));
|
|
1245
|
+
body.append(cut);
|
|
1246
|
+
const breaks = Array.from(cut.querySelectorAll("*")).map((element) => {
|
|
1247
|
+
const style = getComputedStyle(element);
|
|
1248
|
+
return [element, style.breakBefore, style.breakAfter];
|
|
1249
|
+
});
|
|
1250
|
+
for (const [element, before, after] of breaks) {
|
|
1251
|
+
if (PAGE_BREAKS.includes(before))
|
|
1252
|
+
element.style.breakBefore = "column";
|
|
1253
|
+
if (PAGE_BREAKS.includes(after))
|
|
1254
|
+
element.style.breakAfter = "column";
|
|
1255
|
+
}
|
|
1256
|
+
flow = cut;
|
|
1257
|
+
stride = contentWidth + COLUMN_GAP;
|
|
1258
|
+
const count = Math.max(1, Math.ceil((cut.scrollWidth + COLUMN_GAP - 1) / stride));
|
|
1259
|
+
const pages = document.createElement("div");
|
|
1260
|
+
pages.className = "sixb-pages";
|
|
1261
|
+
const sheets = Array.from({ length: count }, (_, index) => {
|
|
1262
|
+
const page = document.createElement("article");
|
|
1263
|
+
page.className = "sixb-paper";
|
|
1264
|
+
page.dataset.page = String(index + 1);
|
|
1265
|
+
page.setAttribute("aria-label", `Page ${index + 1} of ${count}`);
|
|
1266
|
+
const content = document.createElement("div");
|
|
1267
|
+
content.className = "sixb-paper-content";
|
|
1268
|
+
if (index === 0)
|
|
1269
|
+
content.append(cut);
|
|
1270
|
+
page.append(content);
|
|
1271
|
+
return page;
|
|
1272
|
+
});
|
|
1273
|
+
pages.append(...sheets);
|
|
1274
|
+
body.replaceChildren(pages);
|
|
1275
|
+
fitPages();
|
|
1276
|
+
const shown = new Set;
|
|
1277
|
+
sheetsInView = new IntersectionObserver((entries) => {
|
|
1278
|
+
for (const entry of entries) {
|
|
1279
|
+
const index = Number(entry.target.dataset.page) - 1;
|
|
1280
|
+
if (entry.isIntersecting)
|
|
1281
|
+
shown.add(index);
|
|
1282
|
+
else
|
|
1283
|
+
shown.delete(index);
|
|
1284
|
+
}
|
|
1285
|
+
for (const [index, sheet] of sheets.entries()) {
|
|
1286
|
+
if (index === 0)
|
|
1287
|
+
continue;
|
|
1288
|
+
if ([...shown].some((each) => Math.abs(each - index) <= NEAR_PAGES))
|
|
1289
|
+
pageCopy(index);
|
|
1290
|
+
else
|
|
1291
|
+
sheet.firstElementChild?.replaceChildren();
|
|
1292
|
+
}
|
|
1293
|
+
reportEmbeds();
|
|
1294
|
+
});
|
|
1295
|
+
for (const sheet of sheets)
|
|
1296
|
+
sheetsInView.observe(sheet);
|
|
1297
|
+
root.setAttribute("data-sixb-pages", String(count));
|
|
1298
|
+
};
|
|
1299
|
+
const markBreaks = () => {
|
|
1300
|
+
const body = document.body;
|
|
1301
|
+
if (!body)
|
|
1302
|
+
return;
|
|
1303
|
+
const divider = () => {
|
|
1304
|
+
const element = document.createElement("div");
|
|
1305
|
+
element.className = "sixb-page-break";
|
|
1306
|
+
element.setAttribute("aria-hidden", "true");
|
|
1307
|
+
return element;
|
|
1308
|
+
};
|
|
1309
|
+
const placed = (element) => element.previousElementSibling?.classList.contains("sixb-page-break") || element.previousElementSibling === null;
|
|
1310
|
+
for (const element of Array.from(body.querySelectorAll("*"))) {
|
|
1311
|
+
const parent = element.parentElement;
|
|
1312
|
+
if (!parent || /flex|grid/.test(getComputedStyle(parent).display))
|
|
1313
|
+
continue;
|
|
1314
|
+
const style = getComputedStyle(element);
|
|
1315
|
+
if (PAGE_BREAKS.includes(style.breakBefore) && !placed(element) && element.offsetTop > 0) {
|
|
1316
|
+
element.before(divider());
|
|
1317
|
+
}
|
|
1318
|
+
const next = element.nextElementSibling;
|
|
1319
|
+
if (PAGE_BREAKS.includes(style.breakAfter) && next && !placed(next))
|
|
1320
|
+
element.after(divider());
|
|
1321
|
+
}
|
|
1322
|
+
};
|
|
1323
|
+
const settled = () => {
|
|
1324
|
+
const images = Array.from(document.images, (image) => {
|
|
1325
|
+
if (paged)
|
|
1326
|
+
image.loading = "eager";
|
|
1327
|
+
return image.complete ? Promise.resolve() : image.decode().catch(() => {});
|
|
1328
|
+
});
|
|
1329
|
+
const fonts = document.fonts?.ready ?? Promise.resolve();
|
|
1330
|
+
const loaded = Promise.all([fonts, ...images]).then(() => {});
|
|
1331
|
+
return Promise.race([loaded, new Promise((resolve) => setTimeout(resolve, 5000))]);
|
|
1332
|
+
};
|
|
1333
|
+
const openSection = () => {
|
|
1334
|
+
const section = start.get("sixb-section");
|
|
1335
|
+
if (!section)
|
|
1336
|
+
return;
|
|
1337
|
+
shownCopy(`[data-sixb-section="${CSS.escape(section)}"]`)?.scrollIntoView({ block: "start" });
|
|
1338
|
+
};
|
|
788
1339
|
let height = -1;
|
|
789
1340
|
const reportSize = () => {
|
|
790
1341
|
const body = document.body;
|
|
@@ -810,10 +1361,10 @@ function frameRuntime() {
|
|
|
810
1361
|
};
|
|
811
1362
|
const portPost = typeof MessagePort === "function" ? MessagePort.prototype.postMessage : undefined;
|
|
812
1363
|
const apply = Reflect.apply;
|
|
813
|
-
let
|
|
814
|
-
const
|
|
815
|
-
if (
|
|
816
|
-
apply(portPost,
|
|
1364
|
+
let appPort = null;
|
|
1365
|
+
const postPort = (message) => {
|
|
1366
|
+
if (appPort && portPost)
|
|
1367
|
+
apply(portPost, appPort, [{ protocol: PROTOCOL, ...message }]);
|
|
817
1368
|
};
|
|
818
1369
|
let editing = false;
|
|
819
1370
|
let typable = true;
|
|
@@ -886,6 +1437,35 @@ function frameRuntime() {
|
|
|
886
1437
|
next?.setAttribute(attribute, "");
|
|
887
1438
|
return next;
|
|
888
1439
|
};
|
|
1440
|
+
const collapseSpaces = (element) => {
|
|
1441
|
+
const walker = document.createTreeWalker(element, 4);
|
|
1442
|
+
const nodes = [];
|
|
1443
|
+
while (walker.nextNode())
|
|
1444
|
+
nodes.push(walker.currentNode);
|
|
1445
|
+
let after = true;
|
|
1446
|
+
const runs = [];
|
|
1447
|
+
for (const node of nodes) {
|
|
1448
|
+
for (const run of node.data.matchAll(/[ \t\n\r\f]+|[^ \t\n\r\f]+/g)) {
|
|
1449
|
+
const index = run.index ?? 0;
|
|
1450
|
+
if (!/^[ \t\n\r\f]/.test(run[0])) {
|
|
1451
|
+
after = false;
|
|
1452
|
+
continue;
|
|
1453
|
+
}
|
|
1454
|
+
const shown = after ? "" : " ";
|
|
1455
|
+
if (run[0] !== shown)
|
|
1456
|
+
runs.push({ node, start: index, length: run[0].length, with: shown });
|
|
1457
|
+
after = true;
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
const last = runs.at(-1);
|
|
1461
|
+
if (last && last.with === " " && last.start + last.length === last.node.data.length) {
|
|
1462
|
+
const trailing = nodes.slice(nodes.indexOf(last.node) + 1).every((node) => node.data === "");
|
|
1463
|
+
if (trailing)
|
|
1464
|
+
last.with = "";
|
|
1465
|
+
}
|
|
1466
|
+
for (const run of runs.reverse())
|
|
1467
|
+
run.node.replaceData(run.start, run.length, run.with);
|
|
1468
|
+
};
|
|
889
1469
|
const stopTyping = () => {
|
|
890
1470
|
const element = typing;
|
|
891
1471
|
if (!element)
|
|
@@ -944,9 +1524,13 @@ function frameRuntime() {
|
|
|
944
1524
|
const { element, target } = editTarget(event.target);
|
|
945
1525
|
picked = mark("data-sixb-picked", picked, commentable(element, event.target));
|
|
946
1526
|
const at = { x: event.clientX, y: event.clientY };
|
|
947
|
-
|
|
1527
|
+
postPort({ event: "edit.select", params: { target, at } });
|
|
948
1528
|
if (typable && element instanceof HTMLElement && target.kind === "text") {
|
|
949
1529
|
typing = element;
|
|
1530
|
+
if (!/^(pre|pre-wrap|break-spaces)$/.test(getComputedStyle(element).whiteSpace)) {
|
|
1531
|
+
collapseSpaces(element);
|
|
1532
|
+
element.setAttribute(WORDS, wordsHash(element.textContent ?? ""));
|
|
1533
|
+
}
|
|
950
1534
|
typedFrom = element.textContent ?? "";
|
|
951
1535
|
element.setAttribute("contenteditable", "plaintext-only");
|
|
952
1536
|
element.focus();
|
|
@@ -960,13 +1544,13 @@ function frameRuntime() {
|
|
|
960
1544
|
if (shown === pointed && shown !== null)
|
|
961
1545
|
return;
|
|
962
1546
|
pointed = mark("data-sixb-hover", pointed, shown);
|
|
963
|
-
|
|
1547
|
+
postPort({ event: "edit.hover", params: { target } });
|
|
964
1548
|
});
|
|
965
1549
|
document.addEventListener("mouseout", (event) => {
|
|
966
1550
|
if (!editing || !event.isTrusted || event.relatedTarget !== null || pointed === null)
|
|
967
1551
|
return;
|
|
968
1552
|
pointed = mark("data-sixb-hover", pointed, null);
|
|
969
|
-
|
|
1553
|
+
postPort({ event: "edit.hover", params: { target: null } });
|
|
970
1554
|
});
|
|
971
1555
|
document.addEventListener("input", (event) => {
|
|
972
1556
|
if (!editing || !event.isTrusted || !typing || !typing.contains(event.target)) {
|
|
@@ -974,7 +1558,7 @@ function frameRuntime() {
|
|
|
974
1558
|
}
|
|
975
1559
|
const text = typing.textContent ?? "";
|
|
976
1560
|
typing.setAttribute(WORDS, wordsHash(text));
|
|
977
|
-
|
|
1561
|
+
postPort({
|
|
978
1562
|
event: "edit.text",
|
|
979
1563
|
params: { address: typing.getAttribute(AT), base: typedFrom, text }
|
|
980
1564
|
});
|
|
@@ -993,8 +1577,209 @@ function frameRuntime() {
|
|
|
993
1577
|
if (typing && event.target === typing)
|
|
994
1578
|
stopTyping();
|
|
995
1579
|
});
|
|
1580
|
+
const mac = /Mac|iPhone|iPad/.test(window.navigator?.platform ?? "");
|
|
1581
|
+
const zoom = (params) => postPort({ event: "zoom", params });
|
|
1582
|
+
const pan = (x, y, by) => postPort({ event: "pan", params: { x, y, by } });
|
|
1583
|
+
const forwards = (event) => appPort !== null && event.isTrusted;
|
|
1584
|
+
let onCanvas = false;
|
|
1585
|
+
let canvasMoving = false;
|
|
1586
|
+
const WHEEL_GESTURE_MS = 150;
|
|
1587
|
+
const MIN_OVERFLOW = 16;
|
|
1588
|
+
let wheeledAt = Number.NEGATIVE_INFINITY;
|
|
1589
|
+
let wheelScrolls = false;
|
|
1590
|
+
const scrollsUnder = (target, x, y) => {
|
|
1591
|
+
const vertical = Math.abs(y) >= Math.abs(x);
|
|
1592
|
+
const delta = vertical ? y : x;
|
|
1593
|
+
if (delta === 0)
|
|
1594
|
+
return false;
|
|
1595
|
+
const overflowOf = (element) => getComputedStyle(element)[vertical ? "overflowY" : "overflowX"];
|
|
1596
|
+
const scrolls = (size, shown, at) => size - shown >= MIN_OVERFLOW && (delta > 0 ? at + shown < size - 1 : at > 0);
|
|
1597
|
+
for (let element = target instanceof Element ? target : null;element && element !== root && element !== document.body; element = element.parentElement) {
|
|
1598
|
+
if (!/auto|scroll/.test(overflowOf(element)))
|
|
1599
|
+
continue;
|
|
1600
|
+
const scrolled = vertical ? scrolls(element.scrollHeight, element.clientHeight, element.scrollTop) : scrolls(element.scrollWidth, element.clientWidth, element.scrollLeft);
|
|
1601
|
+
if (scrolled)
|
|
1602
|
+
return true;
|
|
1603
|
+
}
|
|
1604
|
+
const page = document.scrollingElement;
|
|
1605
|
+
if (!page || [root, document.body].some((each) => each && /hidden|clip/.test(overflowOf(each)))) {
|
|
1606
|
+
return false;
|
|
1607
|
+
}
|
|
1608
|
+
return vertical ? scrolls(page.scrollHeight, window.innerHeight, window.scrollY) : scrolls(page.scrollWidth, window.innerWidth, window.scrollX);
|
|
1609
|
+
};
|
|
1610
|
+
window.addEventListener("wheel", (event) => {
|
|
1611
|
+
if (!forwards(event))
|
|
1612
|
+
return;
|
|
1613
|
+
if (event.ctrlKey || event.metaKey) {
|
|
1614
|
+
event.preventDefault();
|
|
1615
|
+
const unit = event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 0.002;
|
|
1616
|
+
const factor = 2 ** (-event.deltaY * unit * (event.ctrlKey && mac ? 10 : 1));
|
|
1617
|
+
zoom({ factor, at: { x: event.clientX, y: event.clientY } });
|
|
1618
|
+
return;
|
|
1619
|
+
}
|
|
1620
|
+
if (!onCanvas)
|
|
1621
|
+
return;
|
|
1622
|
+
const unit = event.deltaMode === 1 ? 20 : event.deltaMode === 2 ? window.innerHeight : 1;
|
|
1623
|
+
const x = (!mac && event.shiftKey ? event.deltaY : event.deltaX) * unit;
|
|
1624
|
+
const y = !mac && event.shiftKey ? 0 : event.deltaY * unit;
|
|
1625
|
+
if (event.timeStamp - wheeledAt > WHEEL_GESTURE_MS) {
|
|
1626
|
+
wheelScrolls = !canvasMoving && scrollsUnder(event.target, x, y);
|
|
1627
|
+
}
|
|
1628
|
+
wheeledAt = event.timeStamp;
|
|
1629
|
+
if (wheelScrolls)
|
|
1630
|
+
return;
|
|
1631
|
+
event.preventDefault();
|
|
1632
|
+
pan(x, y, "wheel");
|
|
1633
|
+
}, { passive: false });
|
|
1634
|
+
const TOUCH_SLOP = 6;
|
|
1635
|
+
let spread = 0;
|
|
1636
|
+
let touched = null;
|
|
1637
|
+
const spreadOf = (touches) => {
|
|
1638
|
+
const [one, two] = [touches[0], touches[1]];
|
|
1639
|
+
return one && two ? Math.hypot(one.screenX - two.screenX, one.screenY - two.screenY) : 0;
|
|
1640
|
+
};
|
|
1641
|
+
const middleOf = (touches) => {
|
|
1642
|
+
const fingers = [touches[0], touches[1]].filter((touch) => touch !== undefined);
|
|
1643
|
+
const sum = (axis) => fingers.reduce((total, touch) => total + touch[axis], 0) / Math.max(1, fingers.length);
|
|
1644
|
+
return { x: sum("screenX"), y: sum("screenY") };
|
|
1645
|
+
};
|
|
1646
|
+
window.addEventListener("touchstart", (event) => {
|
|
1647
|
+
const ours = forwards(event);
|
|
1648
|
+
spread = ours && event.touches.length === 2 ? spreadOf(event.touches) : 0;
|
|
1649
|
+
touched = ours && onCanvas ? { ...middleOf(event.touches), dragging: event.touches.length > 1 } : null;
|
|
1650
|
+
}, { passive: true });
|
|
1651
|
+
window.addEventListener("touchmove", (event) => {
|
|
1652
|
+
if (!forwards(event))
|
|
1653
|
+
return;
|
|
1654
|
+
if (touched && event.touches.length <= 2) {
|
|
1655
|
+
const middle = middleOf(event.touches);
|
|
1656
|
+
const x = touched.x - middle.x;
|
|
1657
|
+
const y = touched.y - middle.y;
|
|
1658
|
+
if (!touched.dragging && Math.hypot(x, y) < TOUCH_SLOP)
|
|
1659
|
+
return;
|
|
1660
|
+
event.preventDefault();
|
|
1661
|
+
touched = { ...middle, dragging: true };
|
|
1662
|
+
if (x !== 0 || y !== 0)
|
|
1663
|
+
pan(x, y, "touch");
|
|
1664
|
+
}
|
|
1665
|
+
if (event.touches.length !== 2 || spread === 0)
|
|
1666
|
+
return;
|
|
1667
|
+
event.preventDefault();
|
|
1668
|
+
const [one, two] = [event.touches[0], event.touches[1]];
|
|
1669
|
+
const next = spreadOf(event.touches);
|
|
1670
|
+
if (!one || !two || next === 0)
|
|
1671
|
+
return;
|
|
1672
|
+
zoom({
|
|
1673
|
+
factor: next / spread,
|
|
1674
|
+
at: { x: (one.clientX + two.clientX) / 2, y: (one.clientY + two.clientY) / 2 }
|
|
1675
|
+
});
|
|
1676
|
+
spread = next;
|
|
1677
|
+
}, { passive: false });
|
|
1678
|
+
const untouch = (event) => {
|
|
1679
|
+
if (event.touches.length < 2)
|
|
1680
|
+
spread = 0;
|
|
1681
|
+
if (touched)
|
|
1682
|
+
touched = event.touches.length > 0 ? { ...middleOf(event.touches), dragging: true } : null;
|
|
1683
|
+
};
|
|
1684
|
+
window.addEventListener("touchend", untouch);
|
|
1685
|
+
window.addEventListener("touchcancel", untouch);
|
|
1686
|
+
let gestured = 1;
|
|
1687
|
+
const onGesture = (event) => {
|
|
1688
|
+
if (!forwards(event))
|
|
1689
|
+
return;
|
|
1690
|
+
event.preventDefault();
|
|
1691
|
+
const gesture = event;
|
|
1692
|
+
const scale = gesture.scale ?? 1;
|
|
1693
|
+
if (event.type === "gesturestart" || spread > 0 || scale <= 0) {
|
|
1694
|
+
gestured = scale > 0 ? scale : 1;
|
|
1695
|
+
return;
|
|
1696
|
+
}
|
|
1697
|
+
zoom({ factor: scale / gestured, at: { x: gesture.clientX ?? 0, y: gesture.clientY ?? 0 } });
|
|
1698
|
+
gestured = scale;
|
|
1699
|
+
};
|
|
1700
|
+
window.addEventListener("gesturestart", onGesture, { passive: false });
|
|
1701
|
+
window.addEventListener("gesturechange", onGesture, { passive: false });
|
|
1702
|
+
window.addEventListener("keydown", (event) => {
|
|
1703
|
+
if (!forwards(event) || !(event.metaKey || event.ctrlKey) || event.altKey)
|
|
1704
|
+
return;
|
|
1705
|
+
const step = event.key === "=" || event.key === "+" ? "in" : event.key === "-" ? "out" : event.key === "0" ? "actual" : null;
|
|
1706
|
+
if (!step)
|
|
1707
|
+
return;
|
|
1708
|
+
event.preventDefault();
|
|
1709
|
+
zoom({ step });
|
|
1710
|
+
}, true);
|
|
1711
|
+
const SPACE_TAKERS = [
|
|
1712
|
+
"input:not([type=button], [type=submit], [type=reset], [type=image])",
|
|
1713
|
+
"textarea",
|
|
1714
|
+
"select",
|
|
1715
|
+
...[
|
|
1716
|
+
"checkbox",
|
|
1717
|
+
"radio",
|
|
1718
|
+
"switch",
|
|
1719
|
+
"option",
|
|
1720
|
+
"menuitemcheckbox",
|
|
1721
|
+
"menuitemradio",
|
|
1722
|
+
"textbox",
|
|
1723
|
+
"searchbox",
|
|
1724
|
+
"combobox",
|
|
1725
|
+
"slider",
|
|
1726
|
+
"spinbutton"
|
|
1727
|
+
].map((role) => `[role=${role}]`)
|
|
1728
|
+
].join(", ");
|
|
1729
|
+
let spaceHeld = false;
|
|
1730
|
+
const holdSpace = (down) => {
|
|
1731
|
+
if (spaceHeld === down)
|
|
1732
|
+
return;
|
|
1733
|
+
spaceHeld = down;
|
|
1734
|
+
postPort({ event: "space", params: { down } });
|
|
1735
|
+
};
|
|
1736
|
+
const onSpace = (event) => {
|
|
1737
|
+
if (!onCanvas || !forwards(event) || event.key !== " ")
|
|
1738
|
+
return;
|
|
1739
|
+
if (event.metaKey || event.ctrlKey || event.altKey)
|
|
1740
|
+
return;
|
|
1741
|
+
const down = event.type === "keydown";
|
|
1742
|
+
const focused = document.activeElement;
|
|
1743
|
+
if (down && focused instanceof HTMLElement) {
|
|
1744
|
+
if (focused.isContentEditable || focused.matches(SPACE_TAKERS))
|
|
1745
|
+
return;
|
|
1746
|
+
}
|
|
1747
|
+
if (!down && !spaceHeld)
|
|
1748
|
+
return;
|
|
1749
|
+
event.preventDefault();
|
|
1750
|
+
event.stopPropagation();
|
|
1751
|
+
holdSpace(down);
|
|
1752
|
+
};
|
|
1753
|
+
window.addEventListener("keydown", onSpace, true);
|
|
1754
|
+
window.addEventListener("keyup", onSpace, true);
|
|
1755
|
+
window.addEventListener("blur", () => holdSpace(false));
|
|
1756
|
+
let editorPort = null;
|
|
1757
|
+
let editorOn = false;
|
|
1758
|
+
const startEditor = (code) => {
|
|
1759
|
+
if (editorOn)
|
|
1760
|
+
throw new Error("The editor is already running.");
|
|
1761
|
+
if (!designed || !new URLSearchParams(window.location.search).has("sixb-edit")) {
|
|
1762
|
+
throw new Error("Only a designed document served for editing takes an editor.");
|
|
1763
|
+
}
|
|
1764
|
+
if (!editorPort || !document.body)
|
|
1765
|
+
throw new Error("The editor needs its port and a body.");
|
|
1766
|
+
const script = document.createElement("script");
|
|
1767
|
+
script.textContent = code;
|
|
1768
|
+
document.head.append(script);
|
|
1769
|
+
script.remove();
|
|
1770
|
+
const scope = window;
|
|
1771
|
+
const start = scope[EDITOR_GLOBAL];
|
|
1772
|
+
delete scope[EDITOR_GLOBAL];
|
|
1773
|
+
if (typeof start !== "function")
|
|
1774
|
+
throw new Error("The editor did not start.");
|
|
1775
|
+
editorOn = true;
|
|
1776
|
+
start({ port: editorPort, body: document.body });
|
|
1777
|
+
};
|
|
996
1778
|
const handle = (method, params) => {
|
|
997
1779
|
switch (method) {
|
|
1780
|
+
case "editor":
|
|
1781
|
+
startEditor(String(params.code ?? ""));
|
|
1782
|
+
return;
|
|
998
1783
|
case "theme": {
|
|
999
1784
|
const tokens = params.tokens ?? {};
|
|
1000
1785
|
const declarations = Object.entries(tokens).filter(([name, value]) => /^--[a-z0-9-]+$/.test(name) && typeof value === "string" && !/[;{}<]/.test(value)).map(([name, value]) => `${name}: ${value};`);
|
|
@@ -1036,6 +1821,16 @@ function frameRuntime() {
|
|
|
1036
1821
|
case "edit":
|
|
1037
1822
|
startEditing(params.on === true, params.typing !== false);
|
|
1038
1823
|
return;
|
|
1824
|
+
case "canvas":
|
|
1825
|
+
onCanvas = true;
|
|
1826
|
+
canvasMoving = params.moving === true;
|
|
1827
|
+
if (!document.getElementById("sixb-canvas")) {
|
|
1828
|
+
const style = document.createElement("style");
|
|
1829
|
+
style.id = "sixb-canvas";
|
|
1830
|
+
style.textContent = CANVAS_CSS;
|
|
1831
|
+
document.head.append(style);
|
|
1832
|
+
}
|
|
1833
|
+
return;
|
|
1039
1834
|
case "edit.patch": {
|
|
1040
1835
|
const patches = Array.isArray(params.patches) ? params.patches : [];
|
|
1041
1836
|
for (const patch of patches) {
|
|
@@ -1156,8 +1951,10 @@ function frameRuntime() {
|
|
|
1156
1951
|
return;
|
|
1157
1952
|
event.stopImmediatePropagation();
|
|
1158
1953
|
const port = event.ports?.[0];
|
|
1159
|
-
if (data.method === "edit" && port)
|
|
1160
|
-
|
|
1954
|
+
if ((data.method === "edit" || data.method === "canvas") && port)
|
|
1955
|
+
appPort = port;
|
|
1956
|
+
if (data.method === "editor" && port)
|
|
1957
|
+
editorPort = port;
|
|
1161
1958
|
try {
|
|
1162
1959
|
handle(String(data.method), data.params ?? {});
|
|
1163
1960
|
post({ id: data.id });
|
|
@@ -1177,14 +1974,28 @@ function frameRuntime() {
|
|
|
1177
1974
|
post({ event: "key", params: { key: event.key } });
|
|
1178
1975
|
});
|
|
1179
1976
|
document.addEventListener("click", (event) => {
|
|
1977
|
+
if (editorOn)
|
|
1978
|
+
return;
|
|
1180
1979
|
const target = event.target;
|
|
1181
1980
|
const pressed = target?.closest('button, [role="button"], a[href^="#"]');
|
|
1182
1981
|
const words = (pressed?.innerText ?? pressed?.textContent ?? "").replace(/\s+/g, " ").trim();
|
|
1183
|
-
if (words && words.length <= MAX_LABEL_LENGTH)
|
|
1982
|
+
if (words && words.length <= MAX_LABEL_LENGTH) {
|
|
1184
1983
|
post({ event: "press", params: { text: words } });
|
|
1984
|
+
if (onCanvas && event.isTrusted)
|
|
1985
|
+
postPort({ event: "press", params: { text: words } });
|
|
1986
|
+
}
|
|
1185
1987
|
const link = target?.closest("a[href]");
|
|
1186
1988
|
if (link) {
|
|
1187
1989
|
const href = link.getAttribute("href") ?? "";
|
|
1990
|
+
if (paged && href.length > 1 && href.startsWith("#") && !event.defaultPrevented) {
|
|
1991
|
+
const id = decodeURIComponent(href.slice(1));
|
|
1992
|
+
const shown = shownCopy(`[id="${CSS.escape(id)}"], [name="${CSS.escape(id)}"]`);
|
|
1993
|
+
if (shown) {
|
|
1994
|
+
event.preventDefault();
|
|
1995
|
+
shown.scrollIntoView({ block: "start" });
|
|
1996
|
+
}
|
|
1997
|
+
return;
|
|
1998
|
+
}
|
|
1188
1999
|
if (href.startsWith("#") || event.defaultPrevented)
|
|
1189
2000
|
return;
|
|
1190
2001
|
event.preventDefault();
|
|
@@ -1207,9 +2018,93 @@ function frameRuntime() {
|
|
|
1207
2018
|
window.addEventListener("resize", () => {
|
|
1208
2019
|
if (deck)
|
|
1209
2020
|
fit();
|
|
2021
|
+
if (paged)
|
|
2022
|
+
fitPages();
|
|
1210
2023
|
reportEmbeds();
|
|
1211
2024
|
});
|
|
2025
|
+
const live = designed && data && !new URLSearchParams(window.location.search).has("sixb-edit") ? data() : null;
|
|
2026
|
+
const tree = {
|
|
2027
|
+
children: (node) => Array.from(node.children),
|
|
2028
|
+
attribute: (node, name) => node.getAttribute(name),
|
|
2029
|
+
setAttribute: (node, name, value) => node.setAttribute(name, value),
|
|
2030
|
+
removeAttribute: (node, name) => node.removeAttribute(name),
|
|
2031
|
+
setText: (node, text) => {
|
|
2032
|
+
node.textContent = text;
|
|
2033
|
+
},
|
|
2034
|
+
clone: (node) => node.cloneNode(true),
|
|
2035
|
+
replace: (node, nodes) => node.replaceWith(...nodes)
|
|
2036
|
+
};
|
|
2037
|
+
let published = null;
|
|
2038
|
+
let reads = null;
|
|
2039
|
+
let showing = 0;
|
|
2040
|
+
const showData = async () => {
|
|
2041
|
+
const body = document.body;
|
|
2042
|
+
if (!live || !body)
|
|
2043
|
+
return false;
|
|
2044
|
+
reads ??= live.reads(live.marks(body, tree));
|
|
2045
|
+
if (!reads.holder && reads.queries.length === 0)
|
|
2046
|
+
return false;
|
|
2047
|
+
published ??= body.cloneNode(true);
|
|
2048
|
+
const read = ++showing;
|
|
2049
|
+
const answer = (name) => query(name).then((result) => result, () => {
|
|
2050
|
+
return;
|
|
2051
|
+
});
|
|
2052
|
+
const [holder, ...results] = await Promise.all([
|
|
2053
|
+
reads.holder ? answer("holder") : undefined,
|
|
2054
|
+
...reads.queries.map(answer)
|
|
2055
|
+
]);
|
|
2056
|
+
if (read !== showing)
|
|
2057
|
+
return false;
|
|
2058
|
+
const queries = {};
|
|
2059
|
+
reads.queries.forEach((name, index) => {
|
|
2060
|
+
const result = results[index];
|
|
2061
|
+
if (result)
|
|
2062
|
+
queries[name] = result;
|
|
2063
|
+
});
|
|
2064
|
+
const row = holder?.objects?.[0];
|
|
2065
|
+
body.replaceChildren(...Array.from(published.cloneNode(true).childNodes));
|
|
2066
|
+
live.fill(body, tree, {
|
|
2067
|
+
sources: { ...row ? { holder: row } : {}, queries },
|
|
2068
|
+
lang: root.lang
|
|
2069
|
+
});
|
|
2070
|
+
return true;
|
|
2071
|
+
};
|
|
2072
|
+
if (live) {
|
|
2073
|
+
window.addEventListener("sixb:query", (event) => {
|
|
2074
|
+
const name = event.detail?.name;
|
|
2075
|
+
const shows = name === "holder" ? reads?.holder : reads?.queries.includes(String(name));
|
|
2076
|
+
if (!shows)
|
|
2077
|
+
return;
|
|
2078
|
+
showData().then(async (shown) => {
|
|
2079
|
+
if (!shown)
|
|
2080
|
+
return;
|
|
2081
|
+
if (paged) {
|
|
2082
|
+
if (!root.hasAttribute("data-sixb-pages"))
|
|
2083
|
+
return;
|
|
2084
|
+
await settled();
|
|
2085
|
+
paginate();
|
|
2086
|
+
} else {
|
|
2087
|
+
markBreaks();
|
|
2088
|
+
}
|
|
2089
|
+
reportSize();
|
|
2090
|
+
reportEmbeds();
|
|
2091
|
+
});
|
|
2092
|
+
});
|
|
2093
|
+
}
|
|
1212
2094
|
const ready = () => {
|
|
2095
|
+
if (paged) {
|
|
2096
|
+
showData().then(settled).then(() => {
|
|
2097
|
+
paginate();
|
|
2098
|
+
openSection();
|
|
2099
|
+
reportSize();
|
|
2100
|
+
reportEmbeds();
|
|
2101
|
+
});
|
|
2102
|
+
} else if (designed) {
|
|
2103
|
+
showData().then(() => {
|
|
2104
|
+
markBreaks();
|
|
2105
|
+
settled().then(openSection);
|
|
2106
|
+
});
|
|
2107
|
+
}
|
|
1213
2108
|
if (!deck) {
|
|
1214
2109
|
post({ event: "ready", params: {} });
|
|
1215
2110
|
window.addEventListener("scroll", reportEmbeds, { passive: true });
|
|
@@ -1258,20 +2153,25 @@ var FRAME_CDN_ALLOWLIST2 = [
|
|
|
1258
2153
|
var FRAME_ASSETS2 = {
|
|
1259
2154
|
[`${FRAME_ASSET_PREFIX}deck.css`]: { body: FRAME_DECK_CSS, type: "text/css; charset=utf-8" },
|
|
1260
2155
|
[`${FRAME_ASSET_PREFIX}page.css`]: { body: FRAME_PAGE_CSS, type: "text/css; charset=utf-8" },
|
|
2156
|
+
[`${FRAME_ASSET_PREFIX}document.css`]: {
|
|
2157
|
+
body: FRAME_DOCUMENT_CSS,
|
|
2158
|
+
type: "text/css; charset=utf-8"
|
|
2159
|
+
},
|
|
1261
2160
|
[`${FRAME_ASSET_PREFIX}runtime.js`]: {
|
|
1262
|
-
body: `(${frameRuntime.toString()})()
|
|
2161
|
+
body: `(${frameRuntime.toString()})(${documentData.toString()})
|
|
1263
2162
|
`,
|
|
1264
2163
|
type: "text/javascript; charset=utf-8"
|
|
1265
2164
|
}
|
|
1266
2165
|
};
|
|
1267
|
-
function injected(layout, base) {
|
|
1268
|
-
|
|
2166
|
+
function injected(layout, base, paper) {
|
|
2167
|
+
const sheet = paper ? ` data-sixb-paper="${[paper.width, paper.height, paper.margin.top, paper.margin.right, paper.margin.bottom, paper.margin.left].join(" ")}"` : "";
|
|
2168
|
+
return `<link rel="stylesheet" href="${base}${FRAME_ASSET_PREFIX}${layout}.css"><script src="${base}${FRAME_ASSET_PREFIX}runtime.js" data-sixb-layout="${layout}"${sheet}></script>`;
|
|
1269
2169
|
}
|
|
1270
2170
|
function rootOf(entry) {
|
|
1271
2171
|
return "../".repeat(entry.split("/").length - 1);
|
|
1272
2172
|
}
|
|
1273
|
-
function injectFrameAssets2(html, layout, entry = "index.html") {
|
|
1274
|
-
const assets = injected(layout, rootOf(entry));
|
|
2173
|
+
function injectFrameAssets2(html, layout, entry = "index.html", paper) {
|
|
2174
|
+
const assets = injected(layout, rootOf(entry), paper);
|
|
1275
2175
|
for (const selector of ["head", "html"]) {
|
|
1276
2176
|
let injected = false;
|
|
1277
2177
|
const rewritten = new HTMLRewriter().on(selector, {
|
|
@@ -1288,6 +2188,17 @@ function injectFrameAssets2(html, layout, entry = "index.html") {
|
|
|
1288
2188
|
const doctype = /^\s*<!doctype[^>]*>/i.exec(html)?.[0] ?? "";
|
|
1289
2189
|
return `${doctype}${assets}${html.slice(doctype.length)}`;
|
|
1290
2190
|
}
|
|
2191
|
+
function markDocumentSections2(html, headings) {
|
|
2192
|
+
let index = 0;
|
|
2193
|
+
return new HTMLRewriter().on("h1, h2, h3, h4, h5, h6", {
|
|
2194
|
+
element(element) {
|
|
2195
|
+
const heading = headings[index];
|
|
2196
|
+
index += 1;
|
|
2197
|
+
if (heading?.slug)
|
|
2198
|
+
element.setAttribute("data-sixb-section", heading.slug);
|
|
2199
|
+
}
|
|
2200
|
+
}).transform(html);
|
|
2201
|
+
}
|
|
1291
2202
|
var FRAME_REFERENCE_PREFIX2 = `${FRAME_ASSET_PREFIX}ref/`;
|
|
1292
2203
|
var FRAME_REFERENCE_PATH2 = /^([^/@]+)@(\d+|latest)\/(.+)$/;
|
|
1293
2204
|
function frameReferencePath(target, entry) {
|
|
@@ -1358,6 +2269,6 @@ function serializeArtifactQueryResult2(result) {
|
|
|
1358
2269
|
return result.kind === "objects" ? { ...result, objects: result.objects.map(serializeExpandedObject2) } : result;
|
|
1359
2270
|
}
|
|
1360
2271
|
|
|
1361
|
-
export { ArtifactRequestError2, checkArtifactFiles, readArtifactText, invalidArtifact, decodeHtmlEntities, HTML_ENTRY2, refuseFrameAssetPaths, readHtmlReferences, FRAME_DEFAULT_THEMES2, FRAME_CDN_ALLOWLIST2, FRAME_ASSETS2, injectFrameAssets2, FRAME_REFERENCE_PREFIX2, FRAME_REFERENCE_PATH2, rewriteFrameReferences2, serializeObject2, serializeExpandedObject2, serializeArtifactQueryResult2 };
|
|
2272
|
+
export { ArtifactRequestError2, documentData, documentMarks, fillDocumentHtml, frozenDocumentHtml2, checkArtifactFiles, readArtifactText, invalidArtifact, decodeHtmlEntities, HTML_ENTRY2, refuseFrameAssetPaths, readHtmlReferences, FRAME_DEFAULT_THEMES2, FRAME_CDN_ALLOWLIST2, FRAME_ASSETS2, injectFrameAssets2, markDocumentSections2, FRAME_REFERENCE_PREFIX2, FRAME_REFERENCE_PATH2, rewriteFrameReferences2, serializeObject2, serializeExpandedObject2, serializeArtifactQueryResult2 };
|
|
1362
2273
|
|
|
1363
|
-
//# debugId=
|
|
2274
|
+
//# debugId=2AD526FA661FD3B264756E2164756E21
|