@sixb/core 0.2.4 → 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/execution.d.ts +34 -2
- package/dist/agents/execution.d.ts.map +1 -1
- package/dist/agents/ids.d.ts +2 -0
- package/dist/agents/ids.d.ts.map +1 -1
- package/dist/agents/index.d.ts +6 -4
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +51 -33
- package/dist/agents/index.js.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-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/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 +12 -1
- package/dist/artifacts/frames/protocol.d.ts.map +1 -1
- package/dist/artifacts/frames/runtime.d.ts +24 -4
- package/dist/artifacts/frames/runtime.d.ts.map +1 -1
- package/dist/artifacts/index.d.ts +3 -1
- package/dist/artifacts/index.d.ts.map +1 -1
- package/dist/artifacts/index.js +9 -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-8bns0y68.js → chunk-0hkdtwqk.js} +5 -5
- package/dist/{chunk-p8pgnq8d.js → chunk-0mvjpgvm.js} +5 -5
- package/dist/{chunk-2bn6813a.js → chunk-1yh6jgtz.js} +1 -1
- package/dist/{chunk-msyevpp3.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-td26wjr5.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-3z1vxzcm.js → chunk-aw1z0gre.js} +4 -4
- package/dist/{chunk-evj5jxz3.js → chunk-b4escq4c.js} +62 -14
- package/dist/{chunk-evj5jxz3.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-t0s7b3d1.js → chunk-ey1p8w68.js} +173 -4
- package/dist/chunk-ey1p8w68.js.map +13 -0
- package/dist/{chunk-gxwy4c3s.js → chunk-fpf57gca.js} +316 -57
- package/dist/chunk-fpf57gca.js.map +47 -0
- package/dist/{chunk-r9rtavg9.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-w1wq7gfr.js → chunk-gjhrz66x.js} +225 -17
- package/dist/{chunk-w1wq7gfr.js.map → chunk-gjhrz66x.js.map} +5 -5
- package/dist/chunk-hn2r7z41.js.map +1 -1
- package/dist/{chunk-vepea5c3.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-yy914zfr.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-6ef4esq4.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-rsrc7vtw.js → chunk-rg725hry.js} +174 -30
- package/dist/{chunk-rsrc7vtw.js.map → chunk-rg725hry.js.map} +9 -8
- package/dist/{chunk-rsxb14an.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-hvbvq7p4.js → chunk-vs2s3p8n.js} +731 -10
- 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-rtm1jq00.js → chunk-z1njfqqs.js} +439 -48
- package/dist/{chunk-rtm1jq00.js.map → chunk-z1njfqqs.js.map} +10 -8
- 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-7kpqntgw.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/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 +155 -0
- 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/execution.ts +167 -29
- package/src/agents/ids.ts +5 -0
- package/src/agents/index.ts +18 -4
- 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-http.ts +9 -2
- package/src/agents/run-session-serve.ts +2 -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/turn-answered.ts +31 -0
- package/src/agents/validation.ts +2 -0
- 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 +12 -1
- package/src/artifacts/frames/runtime.ts +413 -6
- package/src/artifacts/index.ts +3 -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 +25 -0
- 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/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 +167 -0
- 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-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-gxwy4c3s.js.map +0 -47
- package/dist/chunk-hvbvq7p4.js.map +0 -18
- 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-smnt672s.js.map +0 -10
- package/dist/chunk-t0s7b3d1.js.map +0 -13
- package/dist/chunk-vzkxqf8h.js.map +0 -23
- package/dist/chunk-wa05txmk.js.map +0 -11
- package/dist/chunk-yv8hv4wq.js.map +0 -10
- package/dist/chunk-yy914zfr.js.map +0 -30
- /package/dist/{chunk-8bns0y68.js.map → chunk-0hkdtwqk.js.map} +0 -0
- /package/dist/{chunk-p8pgnq8d.js.map → chunk-0mvjpgvm.js.map} +0 -0
- /package/dist/{chunk-2bn6813a.js.map → chunk-1yh6jgtz.js.map} +0 -0
- /package/dist/{chunk-msyevpp3.js.map → chunk-5t9gm5tt.js.map} +0 -0
- /package/dist/{chunk-e0hnbb1m.js.map → chunk-61zptves.js.map} +0 -0
- /package/dist/{chunk-td26wjr5.js.map → chunk-68hm50qh.js.map} +0 -0
- /package/dist/{chunk-fe6r7yhg.js.map → chunk-92wrka15.js.map} +0 -0
- /package/dist/{chunk-3z1vxzcm.js.map → chunk-aw1z0gre.js.map} +0 -0
- /package/dist/{chunk-r9rtavg9.js.map → chunk-fzae1jpq.js.map} +0 -0
- /package/dist/{chunk-vepea5c3.js.map → chunk-k29n4176.js.map} +0 -0
- /package/dist/{chunk-sysnvjce.js.map → chunk-naxjka9v.js.map} +0 -0
- /package/dist/{chunk-6ef4esq4.js.map → chunk-pqvvqc65.js.map} +0 -0
- /package/dist/{chunk-rsxb14an.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-7kpqntgw.js.map → chunk-zxhym8tr.js.map} +0 -0
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
DocumentData,
|
|
3
|
+
DocumentQueryResult,
|
|
4
|
+
DocumentReads,
|
|
5
|
+
DocumentTree,
|
|
6
|
+
} from "./document-data"
|
|
7
|
+
|
|
1
8
|
/**
|
|
2
9
|
* The runtime the frame injects before anything else in an entry's `<head>`. It is served as this
|
|
3
|
-
* function's own source, `(${frameRuntime})()`, so it imports nothing
|
|
4
|
-
* itself: the protocol string and the keys repeat what `protocol.ts`
|
|
5
|
-
* the two together. Its tag names the layout, `data-sixb-layout`.
|
|
10
|
+
* function's own source, `(${frameRuntime})(${documentData})`, so it imports nothing but types and
|
|
11
|
+
* names nothing outside itself: the protocol string and the keys repeat what `protocol.ts`
|
|
12
|
+
* declares, and a test holds the two together. Its tag names the layout, `data-sixb-layout`.
|
|
6
13
|
*
|
|
7
14
|
* In every layout it applies the theme the app sends, then fires `sixb:theme` on the window for
|
|
8
15
|
* what draws its own colors; answers the app's requests; and tells the app about the links the
|
|
@@ -14,6 +21,20 @@
|
|
|
14
21
|
* the app about keys and picks in the overview. A page scrolls as it is: it reports the embeds
|
|
15
22
|
* near its view as it scrolls, and its height as it changes.
|
|
16
23
|
*
|
|
24
|
+
* A designed document scrolls as a page does, as one sheet of its paper (`data-sixb-paper`). With
|
|
25
|
+
* `sixb-pages` it is cut into pages instead, once its fonts and images have loaded: its content
|
|
26
|
+
* goes into a flow laid out in columns as wide and tall as the paper's content box, a forced page
|
|
27
|
+
* break becomes a column break, and each column shows on a sheet of its own. The first sheet keeps
|
|
28
|
+
* the original, which is what assistive technology reads; a sheet in view, or next to one, holds
|
|
29
|
+
* a copy of it, made as it comes near and dropped once it is far. It reports how many pages it
|
|
30
|
+
* made. `sixb-section=<slug>` opens it at the heading publishing named so.
|
|
31
|
+
*
|
|
32
|
+
* Its fields and repeated elements show live data, as `documentData`, which the runtime is given,
|
|
33
|
+
* walks them: once it has read the object that holds the document and the queries they name, as
|
|
34
|
+
* the reader, from the document as published, before it is cut into pages; and again, cut anew,
|
|
35
|
+
* whenever one of those changes. Opened on its own, it reads them as `sixb.query` does. Served for
|
|
36
|
+
* editing, it shows what is written in them, which takes no typing.
|
|
37
|
+
*
|
|
17
38
|
* It gives every layout `window.sixb.state`, where a page keeps JSON values for its reader: each
|
|
18
39
|
* call is a message the app answers, and the app keeps the values. Opened on its own, with no app
|
|
19
40
|
* around it, as the layout check opens a page, the values live in memory until it closes.
|
|
@@ -43,9 +64,16 @@
|
|
|
43
64
|
* in place, and the frame sends through the port what moves the canvas, their wheel turns unless
|
|
44
65
|
* the page scrolls them, a finger's drag, Space held to drag, and the zooming above, and the words
|
|
45
66
|
* of what they press, for the canvas to follow the arrow they label.
|
|
67
|
+
*
|
|
68
|
+
* A designed document served for editing may be handed its editor with `editor`: the script the
|
|
69
|
+
* app sends runs once, leaving a start function the runtime takes at once, and is handed the port
|
|
70
|
+
* that came with the request and the body, which it edits in place. From then on a click on a link
|
|
71
|
+
* places the caret rather than following it.
|
|
46
72
|
*/
|
|
47
|
-
export function frameRuntime(): void {
|
|
73
|
+
export function frameRuntime(data?: () => DocumentData): void {
|
|
48
74
|
const PROTOCOL = "sixb-frame/1"
|
|
75
|
+
/** Where the editor's script leaves its start, as the app's frame editor names it. */
|
|
76
|
+
const EDITOR_GLOBAL = "__sixbFrameEditor"
|
|
49
77
|
const WIDTH = 1280
|
|
50
78
|
const HEIGHT = 720
|
|
51
79
|
const KEYS = [
|
|
@@ -97,12 +125,34 @@ export function frameRuntime(): void {
|
|
|
97
125
|
const root = document.documentElement
|
|
98
126
|
// Only set while the runtime itself runs, so kept for what reads it later.
|
|
99
127
|
const script = document.currentScript as HTMLScriptElement | null
|
|
100
|
-
const
|
|
128
|
+
const layout = script?.getAttribute("data-sixb-layout") ?? "deck"
|
|
129
|
+
const deck = layout === "deck"
|
|
130
|
+
const designed = layout === "document"
|
|
101
131
|
const start = new URLSearchParams(window.location.hash.slice(1))
|
|
102
132
|
if (deck) {
|
|
103
133
|
root.classList.add("sixb-deck")
|
|
104
134
|
root.dataset.mode = start.has("sixb-fill") ? "fill" : "slide"
|
|
105
135
|
}
|
|
136
|
+
/** A designed document's paper, `[width, height, top, right, bottom, left]` in pixels. */
|
|
137
|
+
const paper = (script?.getAttribute("data-sixb-paper") ?? "")
|
|
138
|
+
.split(" ")
|
|
139
|
+
.map(Number)
|
|
140
|
+
.filter((value) => Number.isFinite(value) && value >= 0)
|
|
141
|
+
const hasPaper = paper.length === 6 && (paper[0] ?? 0) > 0 && (paper[1] ?? 0) > 0
|
|
142
|
+
const paged = designed && hasPaper && start.has("sixb-pages")
|
|
143
|
+
if (designed) {
|
|
144
|
+
root.classList.add("sixb-document")
|
|
145
|
+
if (hasPaper) {
|
|
146
|
+
const [width, height, top, right, bottom, left] = paper
|
|
147
|
+
root.style.setProperty("--sixb-paper-width", `${width}px`)
|
|
148
|
+
root.style.setProperty("--sixb-paper-height", `${height}px`)
|
|
149
|
+
root.style.setProperty("--sixb-paper-margin-top", `${top}px`)
|
|
150
|
+
root.style.setProperty("--sixb-paper-margin-right", `${right}px`)
|
|
151
|
+
root.style.setProperty("--sixb-paper-margin-bottom", `${bottom}px`)
|
|
152
|
+
root.style.setProperty("--sixb-paper-margin-left", `${left}px`)
|
|
153
|
+
}
|
|
154
|
+
if (paged) root.classList.add("sixb-pages")
|
|
155
|
+
}
|
|
106
156
|
let current = Number(start.get("sixb-slide")) || 1
|
|
107
157
|
|
|
108
158
|
const slides = (): HTMLElement[] =>
|
|
@@ -182,7 +232,8 @@ export function frameRuntime(): void {
|
|
|
182
232
|
(element) => {
|
|
183
233
|
const id = idOf(element)
|
|
184
234
|
const rect = element.getBoundingClientRect()
|
|
185
|
-
|
|
235
|
+
// Cut into pages, every page holds every embed: only the one its page shows counts.
|
|
236
|
+
return near(rect) && (!paged || shownOnItsPage(element))
|
|
186
237
|
? [
|
|
187
238
|
{
|
|
188
239
|
id,
|
|
@@ -201,6 +252,191 @@ export function frameRuntime(): void {
|
|
|
201
252
|
})
|
|
202
253
|
}
|
|
203
254
|
|
|
255
|
+
// ── A designed document's pages ─────────────────────────────────────
|
|
256
|
+
|
|
257
|
+
/** Break values that start a new page, each a column break in the flow. */
|
|
258
|
+
const PAGE_BREAKS = ["page", "left", "right", "recto", "verso"]
|
|
259
|
+
/** Between columns of the flow, so nothing on one page bleeds into the next. */
|
|
260
|
+
const COLUMN_GAP = 64
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Whether an element in a page's copy of the flow is on that page: inside its content box, which
|
|
264
|
+
* clips the rest. Anything not in a page is shown.
|
|
265
|
+
*/
|
|
266
|
+
const shownOnItsPage = (element: Element): boolean => {
|
|
267
|
+
const box = element.closest(".sixb-paper-content")
|
|
268
|
+
if (!box) return true
|
|
269
|
+
const rect = element.getBoundingClientRect()
|
|
270
|
+
const page = box.getBoundingClientRect()
|
|
271
|
+
return (
|
|
272
|
+
rect.right > page.left &&
|
|
273
|
+
rect.left < page.right &&
|
|
274
|
+
rect.bottom > page.top &&
|
|
275
|
+
rect.top < page.bottom
|
|
276
|
+
)
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/** How many sheets on each side of one in view hold their copy of the flow too. */
|
|
280
|
+
const NEAR_PAGES = 1
|
|
281
|
+
|
|
282
|
+
/** The flow the first sheet holds, the document as published; null until it is cut. */
|
|
283
|
+
let flow: HTMLElement | null = null
|
|
284
|
+
/** How far apart the flow's columns are, one a page. */
|
|
285
|
+
let stride = 0
|
|
286
|
+
/** Which sheets are in view, which keeps a copy of the flow in each sheet near them. */
|
|
287
|
+
let sheetsInView: IntersectionObserver | null = null
|
|
288
|
+
|
|
289
|
+
/** The sheet of page `index`'s copy of the flow, made if it has none: moved to show its column. */
|
|
290
|
+
const pageCopy = (index: number): Element | null => {
|
|
291
|
+
if (index === 0 || !flow) return flow
|
|
292
|
+
const content = document.querySelector(`.sixb-paper[data-page="${index + 1}"] > div`)
|
|
293
|
+
if (!content) return null
|
|
294
|
+
if (content.firstElementChild) return content.firstElementChild
|
|
295
|
+
const copy = flow.cloneNode(true) as HTMLElement
|
|
296
|
+
copy.style.transform = `translateX(${-index * stride}px)`
|
|
297
|
+
copy.setAttribute("aria-hidden", "true")
|
|
298
|
+
copy.inert = true
|
|
299
|
+
content.append(copy)
|
|
300
|
+
return copy
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/** What a selector finds where a reader sees it: cut into pages, the copy on the page it is on. */
|
|
304
|
+
const shownCopy = (selector: string): Element | null => {
|
|
305
|
+
const found = (flow ?? document).querySelector(selector)
|
|
306
|
+
if (!found || !flow) return found
|
|
307
|
+
// Its first fragment's column, which is its page.
|
|
308
|
+
const box = flow.getBoundingClientRect()
|
|
309
|
+
const scale = box.width / flow.offsetWidth || 1
|
|
310
|
+
const left = (found.getClientRects()[0] ?? found.getBoundingClientRect()).left
|
|
311
|
+
const copy = pageCopy(Math.max(0, Math.floor((left - box.left) / scale / stride)))
|
|
312
|
+
if (!copy || copy === flow) return found
|
|
313
|
+
// The same element in the copy, by where it sits in the flow.
|
|
314
|
+
const path: number[] = []
|
|
315
|
+
for (let at: Element = found; at !== flow && at.parentElement; at = at.parentElement) {
|
|
316
|
+
path.unshift(Array.prototype.indexOf.call(at.parentElement.children, at))
|
|
317
|
+
}
|
|
318
|
+
return path.reduce<Element | undefined>((node, index) => node?.children[index], copy) ?? found
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/** The pages, scaled down to fit a frame narrower than the paper, never up. */
|
|
322
|
+
const fitPages = () => {
|
|
323
|
+
const width = paper[0] ?? 0
|
|
324
|
+
const room = window.innerWidth - 32
|
|
325
|
+
root.style.setProperty("--sixb-zoom", String(width > room ? Math.max(0.2, room / width) : 1))
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Cuts the document into pages. The first sheet holds the flow; each other sheet holds a copy of
|
|
330
|
+
* it, moved to show its column, only while it is in view or next to a sheet that is: a long
|
|
331
|
+
* document holds a few copies at a time, never one a page.
|
|
332
|
+
*/
|
|
333
|
+
const paginate = () => {
|
|
334
|
+
sheetsInView?.disconnect()
|
|
335
|
+
const body = document.body
|
|
336
|
+
const [width = 0, height = 0, top = 0, right = 0, bottom = 0, left = 0] = paper
|
|
337
|
+
const contentWidth = Math.max(1, width - left - right)
|
|
338
|
+
const contentHeight = Math.max(1, height - top - bottom)
|
|
339
|
+
const cut = document.createElement("div")
|
|
340
|
+
cut.className = "sixb-flow"
|
|
341
|
+
cut.style.cssText = `width:${contentWidth}px;height:${contentHeight}px;column-width:${contentWidth}px;column-gap:${COLUMN_GAP}px;column-fill:auto;`
|
|
342
|
+
cut.append(...Array.from(body.childNodes))
|
|
343
|
+
body.append(cut)
|
|
344
|
+
// Every style read before any is written, so the flow is laid out once.
|
|
345
|
+
const breaks = Array.from(cut.querySelectorAll<HTMLElement>("*")).map((element) => {
|
|
346
|
+
const style = getComputedStyle(element)
|
|
347
|
+
return [element, style.breakBefore, style.breakAfter] as const
|
|
348
|
+
})
|
|
349
|
+
for (const [element, before, after] of breaks) {
|
|
350
|
+
if (PAGE_BREAKS.includes(before)) element.style.breakBefore = "column"
|
|
351
|
+
if (PAGE_BREAKS.includes(after)) element.style.breakAfter = "column"
|
|
352
|
+
}
|
|
353
|
+
flow = cut
|
|
354
|
+
stride = contentWidth + COLUMN_GAP
|
|
355
|
+
const count = Math.max(1, Math.ceil((cut.scrollWidth + COLUMN_GAP - 1) / stride))
|
|
356
|
+
const pages = document.createElement("div")
|
|
357
|
+
pages.className = "sixb-pages"
|
|
358
|
+
const sheets = Array.from({ length: count }, (_, index) => {
|
|
359
|
+
const page = document.createElement("article")
|
|
360
|
+
page.className = "sixb-paper"
|
|
361
|
+
page.dataset.page = String(index + 1)
|
|
362
|
+
page.setAttribute("aria-label", `Page ${index + 1} of ${count}`)
|
|
363
|
+
const content = document.createElement("div")
|
|
364
|
+
content.className = "sixb-paper-content"
|
|
365
|
+
if (index === 0) content.append(cut)
|
|
366
|
+
page.append(content)
|
|
367
|
+
return page
|
|
368
|
+
})
|
|
369
|
+
pages.append(...sheets)
|
|
370
|
+
body.replaceChildren(pages)
|
|
371
|
+
fitPages()
|
|
372
|
+
|
|
373
|
+
const shown = new Set<number>()
|
|
374
|
+
sheetsInView = new IntersectionObserver((entries) => {
|
|
375
|
+
for (const entry of entries) {
|
|
376
|
+
const index = Number((entry.target as HTMLElement).dataset.page) - 1
|
|
377
|
+
if (entry.isIntersecting) shown.add(index)
|
|
378
|
+
else shown.delete(index)
|
|
379
|
+
}
|
|
380
|
+
for (const [index, sheet] of sheets.entries()) {
|
|
381
|
+
if (index === 0) continue
|
|
382
|
+
if ([...shown].some((each) => Math.abs(each - index) <= NEAR_PAGES)) pageCopy(index)
|
|
383
|
+
else sheet.firstElementChild?.replaceChildren()
|
|
384
|
+
}
|
|
385
|
+
reportEmbeds()
|
|
386
|
+
})
|
|
387
|
+
for (const sheet of sheets) sheetsInView.observe(sheet)
|
|
388
|
+
root.setAttribute("data-sixb-pages", String(count))
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* As one sheet, a forced page break shows as a gap between sheets, so its sections still read
|
|
393
|
+
* apart: a divider before what starts a page, or after what ends one. None at the top, and none
|
|
394
|
+
* inside a flex or grid box, where an element of its own would move what is laid out there.
|
|
395
|
+
*/
|
|
396
|
+
const markBreaks = () => {
|
|
397
|
+
const body = document.body
|
|
398
|
+
if (!body) return
|
|
399
|
+
const divider = () => {
|
|
400
|
+
const element = document.createElement("div")
|
|
401
|
+
element.className = "sixb-page-break"
|
|
402
|
+
element.setAttribute("aria-hidden", "true")
|
|
403
|
+
return element
|
|
404
|
+
}
|
|
405
|
+
const placed = (element: Element) =>
|
|
406
|
+
element.previousElementSibling?.classList.contains("sixb-page-break") ||
|
|
407
|
+
element.previousElementSibling === null
|
|
408
|
+
for (const element of Array.from(body.querySelectorAll<HTMLElement>("*"))) {
|
|
409
|
+
const parent = element.parentElement
|
|
410
|
+
if (!parent || /flex|grid/.test(getComputedStyle(parent).display)) continue
|
|
411
|
+
const style = getComputedStyle(element)
|
|
412
|
+
if (PAGE_BREAKS.includes(style.breakBefore) && !placed(element) && element.offsetTop > 0) {
|
|
413
|
+
element.before(divider())
|
|
414
|
+
}
|
|
415
|
+
const next = element.nextElementSibling
|
|
416
|
+
if (PAGE_BREAKS.includes(style.breakAfter) && next && !placed(next)) element.after(divider())
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/** Waits for what moves text, its fonts and images, a while at most. */
|
|
421
|
+
const settled = (): Promise<void> => {
|
|
422
|
+
const images = Array.from(document.images, (image) => {
|
|
423
|
+
// Cut into pages, an image below the view is laid out on its page all the same: it waits
|
|
424
|
+
// for no scrolling to load.
|
|
425
|
+
if (paged) image.loading = "eager"
|
|
426
|
+
return image.complete ? Promise.resolve() : image.decode().catch(() => {})
|
|
427
|
+
})
|
|
428
|
+
const fonts = document.fonts?.ready ?? Promise.resolve()
|
|
429
|
+
const loaded = Promise.all([fonts, ...images]).then(() => {})
|
|
430
|
+
return Promise.race([loaded, new Promise<void>((resolve) => setTimeout(resolve, 5000))])
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/** Scrolls to the section the start names, in the page that shows it. */
|
|
434
|
+
const openSection = () => {
|
|
435
|
+
const section = start.get("sixb-section")
|
|
436
|
+
if (!section) return
|
|
437
|
+
shownCopy(`[data-sixb-section="${CSS.escape(section)}"]`)?.scrollIntoView({ block: "start" })
|
|
438
|
+
}
|
|
439
|
+
|
|
204
440
|
/**
|
|
205
441
|
* A page's height as laid out, for a document that shows it to size its frame: its body's, not
|
|
206
442
|
* the document's, which is never less than the frame and so would never let the frame shrink.
|
|
@@ -341,6 +577,41 @@ export function frameRuntime(): void {
|
|
|
341
577
|
return next
|
|
342
578
|
}
|
|
343
579
|
|
|
580
|
+
/**
|
|
581
|
+
* Collapses the whitespace in a text element's words as CSS showed it, in place: a browser lays
|
|
582
|
+
* out what takes typing as `pre-wrap`, where the line breaks and indents of its source would
|
|
583
|
+
* show. Each run is replaced on its own, from the end, so the caret the click placed stays where
|
|
584
|
+
* it was. What the reader types is merged into the source, which keeps its own whitespace.
|
|
585
|
+
*/
|
|
586
|
+
const collapseSpaces = (element: Element) => {
|
|
587
|
+
// 4 is NodeFilter.SHOW_TEXT: text nodes alone.
|
|
588
|
+
const walker = document.createTreeWalker(element, 4)
|
|
589
|
+
const nodes: Text[] = []
|
|
590
|
+
while (walker.nextNode()) nodes.push(walker.currentNode as Text)
|
|
591
|
+
// At the start of the block, whitespace shows as nothing, as after a space.
|
|
592
|
+
let after = true
|
|
593
|
+
const runs: { node: Text; start: number; length: number; with: string }[] = []
|
|
594
|
+
for (const node of nodes) {
|
|
595
|
+
for (const run of node.data.matchAll(/[ \t\n\r\f]+|[^ \t\n\r\f]+/g)) {
|
|
596
|
+
const index = run.index ?? 0
|
|
597
|
+
if (!/^[ \t\n\r\f]/.test(run[0])) {
|
|
598
|
+
after = false
|
|
599
|
+
continue
|
|
600
|
+
}
|
|
601
|
+
const shown = after ? "" : " "
|
|
602
|
+
if (run[0] !== shown) runs.push({ node, start: index, length: run[0].length, with: shown })
|
|
603
|
+
after = true
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
// At its end, whitespace shows as nothing either.
|
|
607
|
+
const last = runs.at(-1)
|
|
608
|
+
if (last && last.with === " " && last.start + last.length === last.node.data.length) {
|
|
609
|
+
const trailing = nodes.slice(nodes.indexOf(last.node) + 1).every((node) => node.data === "")
|
|
610
|
+
if (trailing) last.with = ""
|
|
611
|
+
}
|
|
612
|
+
for (const run of runs.reverse()) run.node.replaceData(run.start, run.length, run.with)
|
|
613
|
+
}
|
|
614
|
+
|
|
344
615
|
const stopTyping = () => {
|
|
345
616
|
const element = typing
|
|
346
617
|
if (!element) return
|
|
@@ -407,6 +678,12 @@ export function frameRuntime(): void {
|
|
|
407
678
|
postPort({ event: "edit.select", params: { target, at } })
|
|
408
679
|
if (typable && element instanceof HTMLElement && target.kind === "text") {
|
|
409
680
|
typing = element
|
|
681
|
+
// Unless the page keeps its whitespace, as `pre`, `pre-wrap` and `break-spaces` do. Its
|
|
682
|
+
// words are still the source's, only spaced as they show: it still takes typing.
|
|
683
|
+
if (!/^(pre|pre-wrap|break-spaces)$/.test(getComputedStyle(element).whiteSpace)) {
|
|
684
|
+
collapseSpaces(element)
|
|
685
|
+
element.setAttribute(WORDS, wordsHash(element.textContent ?? ""))
|
|
686
|
+
}
|
|
410
687
|
typedFrom = element.textContent ?? ""
|
|
411
688
|
element.setAttribute("contenteditable", "plaintext-only")
|
|
412
689
|
element.focus()
|
|
@@ -711,8 +988,32 @@ export function frameRuntime(): void {
|
|
|
711
988
|
window.addEventListener("keyup", onSpace, true)
|
|
712
989
|
window.addEventListener("blur", () => holdSpace(false))
|
|
713
990
|
|
|
991
|
+
/** The port the app handed over with `editor`, for the editor alone. */
|
|
992
|
+
let editorPort: MessagePort | null = null
|
|
993
|
+
let editorOn = false
|
|
994
|
+
const startEditor = (code: string) => {
|
|
995
|
+
if (editorOn) throw new Error("The editor is already running.")
|
|
996
|
+
if (!designed || !new URLSearchParams(window.location.search).has("sixb-edit")) {
|
|
997
|
+
throw new Error("Only a designed document served for editing takes an editor.")
|
|
998
|
+
}
|
|
999
|
+
if (!editorPort || !document.body) throw new Error("The editor needs its port and a body.")
|
|
1000
|
+
const script = document.createElement("script")
|
|
1001
|
+
script.textContent = code
|
|
1002
|
+
document.head.append(script)
|
|
1003
|
+
script.remove()
|
|
1004
|
+
const scope = window as unknown as Record<string, unknown>
|
|
1005
|
+
const start = scope[EDITOR_GLOBAL]
|
|
1006
|
+
delete scope[EDITOR_GLOBAL]
|
|
1007
|
+
if (typeof start !== "function") throw new Error("The editor did not start.")
|
|
1008
|
+
editorOn = true
|
|
1009
|
+
start({ port: editorPort, body: document.body })
|
|
1010
|
+
}
|
|
1011
|
+
|
|
714
1012
|
const handle = (method: string, params: Record<string, unknown>) => {
|
|
715
1013
|
switch (method) {
|
|
1014
|
+
case "editor":
|
|
1015
|
+
startEditor(String(params.code ?? ""))
|
|
1016
|
+
return
|
|
716
1017
|
case "theme": {
|
|
717
1018
|
// In the theme's layer, not inline: the deck's own CSS, unlayered, still wins.
|
|
718
1019
|
const tokens = (params.tokens ?? {}) as Record<string, string>
|
|
@@ -929,6 +1230,7 @@ export function frameRuntime(): void {
|
|
|
929
1230
|
event.stopImmediatePropagation()
|
|
930
1231
|
const port = event.ports?.[0]
|
|
931
1232
|
if ((data.method === "edit" || data.method === "canvas") && port) appPort = port
|
|
1233
|
+
if (data.method === "editor" && port) editorPort = port
|
|
932
1234
|
try {
|
|
933
1235
|
handle(String(data.method), (data.params ?? {}) as Record<string, unknown>)
|
|
934
1236
|
post({ id: data.id })
|
|
@@ -950,6 +1252,8 @@ export function frameRuntime(): void {
|
|
|
950
1252
|
})
|
|
951
1253
|
|
|
952
1254
|
document.addEventListener("click", (event) => {
|
|
1255
|
+
// The editor's own: a click there places the caret.
|
|
1256
|
+
if (editorOn) return
|
|
953
1257
|
const target = event.target as HTMLElement | null
|
|
954
1258
|
|
|
955
1259
|
// A button, or a link within the page, by its words: on a canvas, an opened board follows the
|
|
@@ -965,6 +1269,17 @@ export function frameRuntime(): void {
|
|
|
965
1269
|
const link = target?.closest<HTMLAnchorElement>("a[href]")
|
|
966
1270
|
if (link) {
|
|
967
1271
|
const href = link.getAttribute("href") ?? ""
|
|
1272
|
+
// Cut into pages, what a link within the document names is on every page: it moves to the
|
|
1273
|
+
// copy its page shows.
|
|
1274
|
+
if (paged && href.length > 1 && href.startsWith("#") && !event.defaultPrevented) {
|
|
1275
|
+
const id = decodeURIComponent(href.slice(1))
|
|
1276
|
+
const shown = shownCopy(`[id="${CSS.escape(id)}"], [name="${CSS.escape(id)}"]`)
|
|
1277
|
+
if (shown) {
|
|
1278
|
+
event.preventDefault()
|
|
1279
|
+
shown.scrollIntoView({ block: "start" })
|
|
1280
|
+
}
|
|
1281
|
+
return
|
|
1282
|
+
}
|
|
968
1283
|
// A link within the page moves through it, and one the page's own script handled is its.
|
|
969
1284
|
if (href.startsWith("#") || event.defaultPrevented) return
|
|
970
1285
|
|
|
@@ -989,9 +1304,101 @@ export function frameRuntime(): void {
|
|
|
989
1304
|
|
|
990
1305
|
window.addEventListener("resize", () => {
|
|
991
1306
|
if (deck) fit()
|
|
1307
|
+
if (paged) fitPages()
|
|
992
1308
|
reportEmbeds()
|
|
993
1309
|
})
|
|
1310
|
+
/** A designed document's live data, but not while it is served for editing. */
|
|
1311
|
+
const live =
|
|
1312
|
+
designed && data && !new URLSearchParams(window.location.search).has("sixb-edit")
|
|
1313
|
+
? data()
|
|
1314
|
+
: null
|
|
1315
|
+
const tree: DocumentTree<Element> = {
|
|
1316
|
+
children: (node) => Array.from(node.children),
|
|
1317
|
+
attribute: (node, name) => node.getAttribute(name),
|
|
1318
|
+
setAttribute: (node, name, value) => node.setAttribute(name, value),
|
|
1319
|
+
removeAttribute: (node, name) => node.removeAttribute(name),
|
|
1320
|
+
setText: (node, text) => {
|
|
1321
|
+
node.textContent = text
|
|
1322
|
+
},
|
|
1323
|
+
clone: (node) => node.cloneNode(true) as Element,
|
|
1324
|
+
replace: (node, nodes) => node.replaceWith(...nodes),
|
|
1325
|
+
}
|
|
1326
|
+
/** The body as published, which each read of the data is shown in, and what it reads. */
|
|
1327
|
+
let published: Node | null = null
|
|
1328
|
+
let reads: DocumentReads | null = null
|
|
1329
|
+
/** Which read of the data is the latest: an earlier one that answers later shows nothing. */
|
|
1330
|
+
let showing = 0
|
|
1331
|
+
|
|
1332
|
+
/** Reads the data the fields show and shows it, from the body as published. */
|
|
1333
|
+
const showData = async (): Promise<boolean> => {
|
|
1334
|
+
const body = document.body
|
|
1335
|
+
if (!live || !body) return false
|
|
1336
|
+
reads ??= live.reads(live.marks(body, tree))
|
|
1337
|
+
if (!reads.holder && reads.queries.length === 0) return false
|
|
1338
|
+
published ??= body.cloneNode(true)
|
|
1339
|
+
const read = ++showing
|
|
1340
|
+
|
|
1341
|
+
// What the reader may not read keeps its written text.
|
|
1342
|
+
const answer = (name: string) =>
|
|
1343
|
+
query(name).then(
|
|
1344
|
+
(result) => result as DocumentQueryResult,
|
|
1345
|
+
() => undefined
|
|
1346
|
+
)
|
|
1347
|
+
const [holder, ...results] = await Promise.all([
|
|
1348
|
+
reads.holder ? answer("holder") : undefined,
|
|
1349
|
+
...reads.queries.map(answer),
|
|
1350
|
+
])
|
|
1351
|
+
if (read !== showing) return false
|
|
1352
|
+
const queries: Record<string, DocumentQueryResult> = {}
|
|
1353
|
+
reads.queries.forEach((name, index) => {
|
|
1354
|
+
const result = results[index]
|
|
1355
|
+
if (result) queries[name] = result
|
|
1356
|
+
})
|
|
1357
|
+
const row = holder?.objects?.[0]
|
|
1358
|
+
body.replaceChildren(...Array.from(published.cloneNode(true).childNodes))
|
|
1359
|
+
live.fill(body, tree, {
|
|
1360
|
+
sources: { ...(row ? { holder: row } : {}), queries },
|
|
1361
|
+
lang: root.lang,
|
|
1362
|
+
})
|
|
1363
|
+
return true
|
|
1364
|
+
}
|
|
1365
|
+
if (live) {
|
|
1366
|
+
window.addEventListener("sixb:query", (event) => {
|
|
1367
|
+
const name = (event as CustomEvent<{ name?: unknown }>).detail?.name
|
|
1368
|
+
const shows = name === "holder" ? reads?.holder : reads?.queries.includes(String(name))
|
|
1369
|
+
if (!shows) return
|
|
1370
|
+
showData().then(async (shown) => {
|
|
1371
|
+
if (!shown) return
|
|
1372
|
+
if (paged) {
|
|
1373
|
+
// Not yet cut, it is cut once it first settles; cut, it is cut anew once this has.
|
|
1374
|
+
if (!root.hasAttribute("data-sixb-pages")) return
|
|
1375
|
+
await settled()
|
|
1376
|
+
paginate()
|
|
1377
|
+
} else {
|
|
1378
|
+
markBreaks()
|
|
1379
|
+
}
|
|
1380
|
+
reportSize()
|
|
1381
|
+
reportEmbeds()
|
|
1382
|
+
})
|
|
1383
|
+
})
|
|
1384
|
+
}
|
|
1385
|
+
|
|
994
1386
|
const ready = () => {
|
|
1387
|
+
if (paged) {
|
|
1388
|
+
showData()
|
|
1389
|
+
.then(settled)
|
|
1390
|
+
.then(() => {
|
|
1391
|
+
paginate()
|
|
1392
|
+
openSection()
|
|
1393
|
+
reportSize()
|
|
1394
|
+
reportEmbeds()
|
|
1395
|
+
})
|
|
1396
|
+
} else if (designed) {
|
|
1397
|
+
showData().then(() => {
|
|
1398
|
+
markBreaks()
|
|
1399
|
+
settled().then(openSection)
|
|
1400
|
+
})
|
|
1401
|
+
}
|
|
995
1402
|
if (!deck) {
|
|
996
1403
|
post({ event: "ready", params: {} })
|
|
997
1404
|
window.addEventListener("scroll", reportEmbeds, { passive: true })
|
package/src/artifacts/index.ts
CHANGED
|
@@ -102,12 +102,15 @@ export {
|
|
|
102
102
|
type CanvasOutlineItem,
|
|
103
103
|
createHeadingSlugger,
|
|
104
104
|
type DocumentHeading,
|
|
105
|
+
type DocumentHolder,
|
|
105
106
|
type DocumentOutline,
|
|
106
107
|
type FileOutline,
|
|
107
108
|
type SheetOutline,
|
|
108
109
|
type SheetSummary,
|
|
109
110
|
type SlidesOutline,
|
|
110
111
|
} from "./outline"
|
|
112
|
+
export type { DocumentPaper } from "./paper"
|
|
113
|
+
export { DOCUMENT_PDF_WAIT_MS } from "./pdf-job"
|
|
111
114
|
export {
|
|
112
115
|
type ArtifactFacetsQueryResult,
|
|
113
116
|
type ArtifactObjectsQueryResult,
|