@krizaka/ui 4.7.0 → 4.7.1
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/{RotatingWord-D3tpDLE4.d.ts → RotatingWord-CkDcPH9x.d.ts} +2 -2
- package/dist/account-menu.js +2 -2
- package/dist/account-menu.js.map +1 -1
- package/dist/account-settings.d.ts +9 -9
- package/dist/account-settings.js +4 -4
- package/dist/account-settings.js.map +1 -1
- package/dist/achievement.d.ts +3 -3
- package/dist/achievement.js +1 -1
- package/dist/achievement.js.map +1 -1
- package/dist/action-bar.d.ts +1 -1
- package/dist/action-bar.js +5 -5
- package/dist/action-bar.js.map +1 -1
- package/dist/activity-feed.d.ts +2 -2
- package/dist/activity-feed.js +1 -1
- package/dist/activity-feed.js.map +1 -1
- package/dist/alert.d.ts +1 -1
- package/dist/alert.js.map +1 -1
- package/dist/analysis-report.d.ts +1 -1
- package/dist/analysis-report.js +4 -4
- package/dist/analysis-report.js.map +1 -1
- package/dist/anatomy-plate.d.ts +1 -1
- package/dist/anatomy-plate.js +1 -1
- package/dist/anatomy-plate.js.map +1 -1
- package/dist/app-header/search.d.ts +1 -1
- package/dist/app-header/search.js +2 -2
- package/dist/app-header/search.js.map +1 -1
- package/dist/app-header.d.ts +2 -2
- package/dist/app-header.js.map +1 -1
- package/dist/app-shell.d.ts +8 -8
- package/dist/app-shell.js +4 -4
- package/dist/app-shell.js.map +1 -1
- package/dist/architecture-diagram.d.ts +1 -1
- package/dist/architecture-diagram.js.map +1 -1
- package/dist/argument-card.d.ts +2 -2
- package/dist/argument-card.js +6 -6
- package/dist/argument-card.js.map +1 -1
- package/dist/auth-layout.d.ts +1 -1
- package/dist/auth-layout.js.map +1 -1
- package/dist/avatar.d.ts +2 -2
- package/dist/avatar.js.map +1 -1
- package/dist/badge.d.ts +1 -1
- package/dist/badge.js +1 -1
- package/dist/bird-plate.d.ts +1 -1
- package/dist/bird-plate.js +2 -2
- package/dist/bird-plate.js.map +1 -1
- package/dist/button.d.ts +2 -2
- package/dist/button.js +3 -3
- package/dist/captcha.d.ts +2 -2
- package/dist/captcha.js +3 -3
- package/dist/captcha.js.map +1 -1
- package/dist/card-grid.d.ts +1 -1
- package/dist/card-grid.js +1 -1
- package/dist/card-grid.js.map +1 -1
- package/dist/card.d.ts +9 -9
- package/dist/card.js +1 -1
- package/dist/card.js.map +1 -1
- package/dist/catalogue-page.d.ts +2 -2
- package/dist/catalogue-page.js.map +1 -1
- package/dist/changelog-page.d.ts +1 -1
- package/dist/changelog-page.js +2 -2
- package/dist/changelog-page.js.map +1 -1
- package/dist/chapter.d.ts +3 -3
- package/dist/chapter.js +2 -2
- package/dist/chapter.js.map +1 -1
- package/dist/chat.d.ts +3 -3
- package/dist/chat.js +1 -1
- package/dist/chat.js.map +1 -1
- package/dist/checkbox.d.ts +1 -1
- package/dist/checkbox.js.map +1 -1
- package/dist/chip-link.d.ts +1 -1
- package/dist/chip-link.js +1 -1
- package/dist/chip-row.d.ts +2 -2
- package/dist/chip-row.js +1 -1
- package/dist/chip-row.js.map +1 -1
- package/dist/chip.d.ts +4 -5
- package/dist/chip.js +2 -2
- package/dist/choice-grid.d.ts +1 -1
- package/dist/choice-grid.js +2 -2
- package/dist/choice-grid.js.map +1 -1
- package/dist/{chunk-S6NYGOJT.js → chunk-22IORLB5.js} +1 -1
- package/dist/chunk-22IORLB5.js.map +1 -0
- package/dist/{chunk-QA3WETWT.js → chunk-2P7Y3LNN.js} +1 -1
- package/dist/chunk-2P7Y3LNN.js.map +1 -0
- package/dist/{chunk-OGWB76BR.js → chunk-3CEMOJBL.js} +2 -2
- package/dist/chunk-3CEMOJBL.js.map +1 -0
- package/dist/{chunk-WC3SO4CE.js → chunk-3SWWUJJL.js} +2 -2
- package/dist/chunk-3SWWUJJL.js.map +1 -0
- package/dist/{chunk-S2O4NSN5.js → chunk-3TCHVNNB.js} +1 -1
- package/dist/chunk-3TCHVNNB.js.map +1 -0
- package/dist/{chunk-7P7I5OQV.js → chunk-5KBYZLU4.js} +2 -2
- package/dist/chunk-5KBYZLU4.js.map +1 -0
- package/dist/{chunk-WKQ5CB3I.js → chunk-6ARAO3TR.js} +1 -1
- package/dist/{chunk-WKQ5CB3I.js.map → chunk-6ARAO3TR.js.map} +1 -1
- package/dist/{chunk-QHVV2JGF.js → chunk-6LF6IZZM.js} +2 -2
- package/dist/chunk-6LF6IZZM.js.map +1 -0
- package/dist/{chunk-HP7BDMVK.js → chunk-7B5Q76JR.js} +2 -2
- package/dist/chunk-7B5Q76JR.js.map +1 -0
- package/dist/{chunk-F2UZ2WWL.js → chunk-7KIIAOQH.js} +1 -1
- package/dist/{chunk-F2UZ2WWL.js.map → chunk-7KIIAOQH.js.map} +1 -1
- package/dist/{chunk-ADRUEPYC.js → chunk-7MA3UODW.js} +2 -2
- package/dist/{chunk-ADRUEPYC.js.map → chunk-7MA3UODW.js.map} +1 -1
- package/dist/{chunk-KH3JOEPY.js → chunk-7PVLEALV.js} +1 -1
- package/dist/chunk-7PVLEALV.js.map +1 -0
- package/dist/{chunk-QVHSV6RA.js → chunk-7UBLUGNW.js} +1 -1
- package/dist/chunk-7UBLUGNW.js.map +1 -0
- package/dist/{chunk-YTYNKMNS.js → chunk-BKMHN4UA.js} +5 -5
- package/dist/chunk-BKMHN4UA.js.map +1 -0
- package/dist/{chunk-4QH6CP2Y.js → chunk-BRYRZWLV.js} +1 -1
- package/dist/{chunk-4QH6CP2Y.js.map → chunk-BRYRZWLV.js.map} +1 -1
- package/dist/{chunk-43PTCDTL.js → chunk-BVN7JFOP.js} +1 -1
- package/dist/chunk-BVN7JFOP.js.map +1 -0
- package/dist/{chunk-5RWHDX5J.js → chunk-BYKA3FHX.js} +2 -2
- package/dist/chunk-BYKA3FHX.js.map +1 -0
- package/dist/{chunk-5PFCELGW.js → chunk-DIOAQOR5.js} +1 -1
- package/dist/chunk-DIOAQOR5.js.map +1 -0
- package/dist/{chunk-HJFRHYCI.js → chunk-DTGRZXYO.js} +2 -2
- package/dist/{chunk-P7AFIKWG.js → chunk-DVC4YQI2.js} +2 -2
- package/dist/chunk-DVC4YQI2.js.map +1 -0
- package/dist/{chunk-V5RO6JYI.js → chunk-E3LFHTUV.js} +2 -2
- package/dist/chunk-E3LFHTUV.js.map +1 -0
- package/dist/{chunk-WEVYKZIF.js → chunk-EAXIDRMB.js} +1 -1
- package/dist/chunk-EAXIDRMB.js.map +1 -0
- package/dist/{chunk-WU4VLSEA.js → chunk-EYMS6VRF.js} +1 -1
- package/dist/chunk-EYMS6VRF.js.map +1 -0
- package/dist/{chunk-LH5J3VLZ.js → chunk-F7EJZV53.js} +1 -1
- package/dist/chunk-F7EJZV53.js.map +1 -0
- package/dist/{chunk-VPO27AFS.js → chunk-G3L7AKZJ.js} +1 -1
- package/dist/chunk-G3L7AKZJ.js.map +1 -0
- package/dist/{chunk-EB45EVPJ.js → chunk-G5NROYGK.js} +3 -3
- package/dist/chunk-G5NROYGK.js.map +1 -0
- package/dist/{chunk-HKEAYSFS.js → chunk-GQMINKT3.js} +1 -1
- package/dist/{chunk-ENOS6ETI.js.map → chunk-GQMINKT3.js.map} +1 -1
- package/dist/{chunk-3X3OF4TI.js → chunk-H4NXYAL7.js} +1 -1
- package/dist/{chunk-3X3OF4TI.js.map → chunk-H4NXYAL7.js.map} +1 -1
- package/dist/{chunk-KR2W4ONJ.js → chunk-H7I6YLI6.js} +1 -1
- package/dist/chunk-H7I6YLI6.js.map +1 -0
- package/dist/{chunk-PJNR4NTS.js → chunk-HC2TY45B.js} +4 -4
- package/dist/{chunk-NSLXEDIS.js → chunk-HHBTM4AU.js} +1 -1
- package/dist/chunk-HHBTM4AU.js.map +1 -0
- package/dist/{chunk-XVRKKYWU.js → chunk-HVUR3UNK.js} +2 -2
- package/dist/{chunk-XVRKKYWU.js.map → chunk-HVUR3UNK.js.map} +1 -1
- package/dist/{chunk-V7W4RLRW.js → chunk-HWIDTLLO.js} +3 -3
- package/dist/chunk-HWIDTLLO.js.map +1 -0
- package/dist/{chunk-W675RFOA.js → chunk-ISC2QBXJ.js} +1 -1
- package/dist/chunk-ISC2QBXJ.js.map +1 -0
- package/dist/{chunk-7DYZTEE3.js → chunk-IWPB6SSW.js} +1 -1
- package/dist/chunk-IWPB6SSW.js.map +1 -0
- package/dist/{chunk-TVLRE7S3.js → chunk-JDVWUF5W.js} +2 -2
- package/dist/{chunk-TVLRE7S3.js.map → chunk-JDVWUF5W.js.map} +1 -1
- package/dist/{chunk-757ZTGU5.js → chunk-JE2NY4XE.js} +4 -4
- package/dist/chunk-JE2NY4XE.js.map +1 -0
- package/dist/{chunk-HLEBSAGC.js → chunk-KBSZ6JRF.js} +2 -2
- package/dist/chunk-KBSZ6JRF.js.map +1 -0
- package/dist/{chunk-Y3P5B4XS.js → chunk-KCU45KQ3.js} +3 -3
- package/dist/chunk-KCU45KQ3.js.map +1 -0
- package/dist/{chunk-ST5P5HNI.js → chunk-L4YBG5US.js} +4 -4
- package/dist/{chunk-ST5P5HNI.js.map → chunk-L4YBG5US.js.map} +1 -1
- package/dist/{chunk-NG6G6V5E.js → chunk-LFH3LEWR.js} +1 -1
- package/dist/chunk-LFH3LEWR.js.map +1 -0
- package/dist/{chunk-YATTFMDV.js → chunk-LSQQSJ6J.js} +2 -2
- package/dist/{chunk-YATTFMDV.js.map → chunk-LSQQSJ6J.js.map} +1 -1
- package/dist/{chunk-LNAAWT4Y.js → chunk-MJWOZ3JI.js} +1 -1
- package/dist/chunk-MJWOZ3JI.js.map +1 -0
- package/dist/{chunk-KID32IRJ.js → chunk-MXHJMTZ5.js} +1 -1
- package/dist/{chunk-KID32IRJ.js.map → chunk-MXHJMTZ5.js.map} +1 -1
- package/dist/{chunk-GHAN7OOE.js → chunk-N6LAWI4F.js} +2 -2
- package/dist/chunk-N6LAWI4F.js.map +1 -0
- package/dist/{chunk-5VZ37TY3.js → chunk-NFJWD5BT.js} +2 -2
- package/dist/chunk-NFJWD5BT.js.map +1 -0
- package/dist/{chunk-ZPOVOEO3.js → chunk-NJLIHGU4.js} +2 -2
- package/dist/chunk-NJLIHGU4.js.map +1 -0
- package/dist/{chunk-PRD7JRQX.js → chunk-ONCQWOTH.js} +4 -4
- package/dist/{chunk-PRD7JRQX.js.map → chunk-ONCQWOTH.js.map} +1 -1
- package/dist/{chunk-ENOS6ETI.js → chunk-OZC6CDZF.js} +1 -1
- package/dist/{chunk-HKEAYSFS.js.map → chunk-OZC6CDZF.js.map} +1 -1
- package/dist/{chunk-TXFX4PMN.js → chunk-OZY4C4W5.js} +1 -1
- package/dist/{chunk-TXFX4PMN.js.map → chunk-OZY4C4W5.js.map} +1 -1
- package/dist/{chunk-NPMGYLJV.js → chunk-PIRYDEX2.js} +3 -3
- package/dist/chunk-PIRYDEX2.js.map +1 -0
- package/dist/{chunk-C57KK5VB.js → chunk-PM23USOC.js} +1 -1
- package/dist/chunk-PM23USOC.js.map +1 -0
- package/dist/{chunk-PGBF3UBX.js → chunk-QKL5TECH.js} +1 -1
- package/dist/chunk-QKL5TECH.js.map +1 -0
- package/dist/{chunk-Z47KIPCT.js → chunk-QY5JEUJT.js} +1 -1
- package/dist/chunk-QY5JEUJT.js.map +1 -0
- package/dist/{chunk-FVGFPB73.js → chunk-RPVKF4RR.js} +1 -1
- package/dist/{chunk-FVGFPB73.js.map → chunk-RPVKF4RR.js.map} +1 -1
- package/dist/{chunk-NM2DEHFZ.js → chunk-RXYKJIC4.js} +1 -1
- package/dist/chunk-RXYKJIC4.js.map +1 -0
- package/dist/{chunk-W64RAX4N.js → chunk-TKYNYIJS.js} +5 -5
- package/dist/chunk-TKYNYIJS.js.map +1 -0
- package/dist/{chunk-S4TLZRGZ.js → chunk-UMXWOA3I.js} +1 -1
- package/dist/chunk-UMXWOA3I.js.map +1 -0
- package/dist/{chunk-VA4NPCUQ.js → chunk-VD7QFUAP.js} +3 -3
- package/dist/chunk-VD7QFUAP.js.map +1 -0
- package/dist/{chunk-MDSP7DJR.js → chunk-VQELCPQJ.js} +5 -5
- package/dist/chunk-VQELCPQJ.js.map +1 -0
- package/dist/{chunk-2FCQCWIK.js → chunk-VXNBXW3P.js} +5 -5
- package/dist/chunk-VXNBXW3P.js.map +1 -0
- package/dist/{chunk-B47WSPMP.js → chunk-WPUDPH2Q.js} +1 -1
- package/dist/chunk-WPUDPH2Q.js.map +1 -0
- package/dist/{chunk-SG2RKUVJ.js → chunk-WTZUMVJI.js} +5 -5
- package/dist/chunk-WTZUMVJI.js.map +1 -0
- package/dist/{chunk-EDQLPCM4.js → chunk-WVZF6WK3.js} +2 -2
- package/dist/chunk-WVZF6WK3.js.map +1 -0
- package/dist/{chunk-5D7NMUF6.js → chunk-XDAETKWM.js} +2 -2
- package/dist/chunk-XDAETKWM.js.map +1 -0
- package/dist/{chunk-QD6SNXF5.js → chunk-XDWSGNL4.js} +3 -3
- package/dist/chunk-XDWSGNL4.js.map +1 -0
- package/dist/{chunk-SB5WSVPI.js → chunk-ZFH2BYXW.js} +2 -2
- package/dist/chunk-ZFH2BYXW.js.map +1 -0
- package/dist/{chunk-XVLWVTQA.js → chunk-ZI7K742O.js} +1 -1
- package/dist/{chunk-XVLWVTQA.js.map → chunk-ZI7K742O.js.map} +1 -1
- package/dist/{chunk-NQENOT6L.js → chunk-ZRRWSKV3.js} +8 -8
- package/dist/chunk-ZRRWSKV3.js.map +1 -0
- package/dist/cn.js +1 -1
- package/dist/code-block.d.ts +2 -2
- package/dist/code-block.js +2 -2
- package/dist/code-block.js.map +1 -1
- package/dist/collection-switcher.d.ts +1 -1
- package/dist/collection-switcher.js +1 -1
- package/dist/collection-switcher.js.map +1 -1
- package/dist/columns.d.ts +2 -2
- package/dist/columns.js.map +1 -1
- package/dist/combobox.js +4 -4
- package/dist/command.d.ts +10 -10
- package/dist/command.js +4 -4
- package/dist/command.js.map +1 -1
- package/dist/comparison-table.d.ts +1 -1
- package/dist/comparison-table.js +1 -1
- package/dist/comparison-table.js.map +1 -1
- package/dist/component-page.d.ts +1 -1
- package/dist/component-page.js.map +1 -1
- package/dist/confirm-button.d.ts +1 -1
- package/dist/confirm-button.js +4 -4
- package/dist/contact-page.d.ts +1 -1
- package/dist/contact-page.js.map +1 -1
- package/dist/continue-prompt.d.ts +1 -1
- package/dist/continue-prompt.js +1 -1
- package/dist/continue-prompt.js.map +1 -1
- package/dist/copy-button.d.ts +1 -1
- package/dist/copy-button.js +4 -4
- package/dist/copy-button.js.map +1 -1
- package/dist/countdown.d.ts +1 -1
- package/dist/countdown.js.map +1 -1
- package/dist/cover-hero.d.ts +1 -1
- package/dist/cover-hero.js +5 -5
- package/dist/cover-hero.js.map +1 -1
- package/dist/cta-panel.d.ts +1 -1
- package/dist/cta-panel.js +1 -1
- package/dist/cta-panel.js.map +1 -1
- package/dist/dashboard-layout.d.ts +2 -2
- package/dist/dashboard-layout.js.map +1 -1
- package/dist/data-table.d.ts +5 -5
- package/dist/data-table.js +9 -9
- package/dist/date-picker.d.ts +11 -11
- package/dist/date-picker.js +5 -5
- package/dist/date-picker.js.map +1 -1
- package/dist/decision-list.d.ts +1 -1
- package/dist/decision-list.js +2 -2
- package/dist/decision-list.js.map +1 -1
- package/dist/description-list.d.ts +2 -2
- package/dist/description-list.js.map +1 -1
- package/dist/detail-layout.d.ts +5 -5
- package/dist/detail-layout.js +1 -1
- package/dist/detail-layout.js.map +1 -1
- package/dist/{dialog-DpUwec2g.d.ts → dialog-CFnxFGyn.d.ts} +7 -7
- package/dist/dialog.d.ts +2 -2
- package/dist/dialog.js +4 -4
- package/dist/dialog.js.map +1 -1
- package/dist/docs-article-page.d.ts +1 -1
- package/dist/docs-article-page.js.map +1 -1
- package/dist/docs-hub-page.d.ts +1 -1
- package/dist/docs-hub-page.js.map +1 -1
- package/dist/docs-layout.d.ts +1 -1
- package/dist/docs-layout.js +1 -1
- package/dist/docs-layout.js.map +1 -1
- package/dist/docs-nav.d.ts +1 -1
- package/dist/docs-nav.js +1 -1
- package/dist/docs-nav.js.map +1 -1
- package/dist/document-viewer.d.ts +2 -2
- package/dist/document-viewer.js +3 -3
- package/dist/document-viewer.js.map +1 -1
- package/dist/doodle.d.ts +1 -1
- package/dist/doodle.js +1 -1
- package/dist/doodle.js.map +1 -1
- package/dist/drop-overlay.d.ts +1 -1
- package/dist/drop-overlay.js +1 -1
- package/dist/drop-overlay.js.map +1 -1
- package/dist/dropdown-menu.d.ts +8 -8
- package/dist/dropdown-menu.js +2 -2
- package/dist/embed-facade.js +1 -1
- package/dist/empty-state.d.ts +1 -1
- package/dist/empty-state.js.map +1 -1
- package/dist/engine-flow.d.ts +1 -1
- package/dist/engine-flow.js +1 -1
- package/dist/engine-flow.js.map +1 -1
- package/dist/entity-header.d.ts +1 -1
- package/dist/entity-header.js +1 -1
- package/dist/entity-header.js.map +1 -1
- package/dist/environment-notice.d.ts +1 -1
- package/dist/environment-notice.js.map +1 -1
- package/dist/error-page.d.ts +1 -1
- package/dist/error-page.js +1 -1
- package/dist/error-page.js.map +1 -1
- package/dist/field.d.ts +3 -3
- package/dist/field.js +1 -1
- package/dist/field.js.map +1 -1
- package/dist/file-upload.d.ts +1 -1
- package/dist/file-upload.js +1 -1
- package/dist/file-upload.js.map +1 -1
- package/dist/filter-bar.d.ts +2 -2
- package/dist/filter-bar.js +4 -4
- package/dist/flock.d.ts +1 -1
- package/dist/flock.js +2 -2
- package/dist/flock.js.map +1 -1
- package/dist/footnote.d.ts +3 -3
- package/dist/footnote.js +1 -1
- package/dist/footnote.js.map +1 -1
- package/dist/force-update-screen.d.ts +1 -1
- package/dist/force-update-screen.js +3 -3
- package/dist/force-update-screen.js.map +1 -1
- package/dist/form/server.js.map +1 -1
- package/dist/form.d.ts +12 -12
- package/dist/form.js +4 -4
- package/dist/form.js.map +1 -1
- package/dist/{frame-CmDztC_y.d.ts → frame-D5HU_cG8.d.ts} +2 -2
- package/dist/gallery-page.d.ts +1 -1
- package/dist/gallery-page.js +1 -1
- package/dist/gallery-page.js.map +1 -1
- package/dist/genui.d.ts +2 -2
- package/dist/genui.js +9 -9
- package/dist/genui.js.map +1 -1
- package/dist/glossary-term.js +2 -2
- package/dist/glow-card.d.ts +1 -1
- package/dist/glow-card.js +1 -1
- package/dist/glow-card.js.map +1 -1
- package/dist/goal-gauge.d.ts +1 -1
- package/dist/goal-gauge.js +1 -1
- package/dist/goal-gauge.js.map +1 -1
- package/dist/grade-stamp.d.ts +1 -1
- package/dist/grade-stamp.js +2 -2
- package/dist/grade-stamp.js.map +1 -1
- package/dist/identity-card.d.ts +1 -1
- package/dist/identity-card.js +5 -5
- package/dist/identity-card.js.map +1 -1
- package/dist/image-cropper.d.ts +1 -1
- package/dist/image-cropper.js +3 -3
- package/dist/image-cropper.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/kanban.d.ts +1 -1
- package/dist/kanban.js.map +1 -1
- package/dist/kbd.d.ts +1 -1
- package/dist/kbd.js.map +1 -1
- package/dist/kind-config-editor.js +8 -8
- package/dist/kind-config-editor.js.map +1 -1
- package/dist/kpi-explained.js +1 -1
- package/dist/kpi-explained.js.map +1 -1
- package/dist/landing-page.d.ts +1 -1
- package/dist/landing-page.js.map +1 -1
- package/dist/landscape.d.ts +1 -1
- package/dist/landscape.js +2 -2
- package/dist/landscape.js.map +1 -1
- package/dist/language-switch.d.ts +10 -10
- package/dist/language-switch.js +1 -1
- package/dist/legal-page.d.ts +1 -1
- package/dist/legal-page.js.map +1 -1
- package/dist/{lightbox-MRB2YZEP.js → lightbox-JLWASIJC.js} +4 -4
- package/dist/link-card.d.ts +1 -1
- package/dist/link-card.js +4 -4
- package/dist/list.d.ts +1 -1
- package/dist/list.js +2 -2
- package/dist/list.js.map +1 -1
- package/dist/loader.d.ts +2 -2
- package/dist/loader.js +1 -1
- package/dist/loader.js.map +1 -1
- package/dist/longform-page.d.ts +1 -1
- package/dist/longform-page.js +1 -1
- package/dist/longform-page.js.map +1 -1
- package/dist/maintenance-screen.d.ts +1 -1
- package/dist/maintenance-screen.js +3 -3
- package/dist/maintenance-screen.js.map +1 -1
- package/dist/map/cards.d.ts +2 -2
- package/dist/map/cards.js +1 -1
- package/dist/map/cards.js.map +1 -1
- package/dist/map/pin.js +1 -1
- package/dist/map/sheet.d.ts +1 -1
- package/dist/map/sheet.js +1 -1
- package/dist/map/sheet.js.map +1 -1
- package/dist/map.d.ts +11 -11
- package/dist/map.js +4 -4
- package/dist/map.js.map +1 -1
- package/dist/margin-layout.d.ts +2 -2
- package/dist/margin-layout.js.map +1 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/markdown.js.map +1 -1
- package/dist/marketing-layout.d.ts +1 -1
- package/dist/marketing-layout.js.map +1 -1
- package/dist/mascot-quote.d.ts +1 -1
- package/dist/mascot-quote.js +2 -2
- package/dist/mascot-quote.js.map +1 -1
- package/dist/mascot-state.d.ts +5 -5
- package/dist/mascot-state.js +1 -1
- package/dist/mascot-state.js.map +1 -1
- package/dist/mascots.d.ts +2 -2
- package/dist/mascots.js +2 -2
- package/dist/mascots.js.map +1 -1
- package/dist/match-dialog.d.ts +1 -1
- package/dist/match-dialog.js +4 -4
- package/dist/match-dialog.js.map +1 -1
- package/dist/media-capture.d.ts +1 -1
- package/dist/media-capture.js +1 -1
- package/dist/media-capture.js.map +1 -1
- package/dist/media-carousel.js +5 -5
- package/dist/media-carousel.js.map +1 -1
- package/dist/media-gallery.d.ts +1 -1
- package/dist/media-gallery.js +1 -1
- package/dist/media-gallery.js.map +1 -1
- package/dist/media-player.d.ts +1 -1
- package/dist/media-player.js +4 -4
- package/dist/meter.d.ts +2 -2
- package/dist/meter.js +1 -1
- package/dist/money-input.d.ts +1 -1
- package/dist/money-input.js +3 -3
- package/dist/motion.d.ts +1 -1
- package/dist/motion.js +1 -1
- package/dist/native/form.d.ts +12 -12
- package/dist/native/form.js +4 -4
- package/dist/native/form.js.map +1 -1
- package/dist/native/list.d.ts +1 -1
- package/dist/native/list.js.map +1 -1
- package/dist/native/map.d.ts +4 -4
- package/dist/native/map.js +2 -2
- package/dist/native/map.js.map +1 -1
- package/dist/native/markdown.js.map +1 -1
- package/dist/native/media-capture.d.ts +1 -1
- package/dist/native/media-capture.js.map +1 -1
- package/dist/native/media-picker.d.ts +1 -1
- package/dist/native/media-picker.js.map +1 -1
- package/dist/native/vertical-video.d.ts +2 -2
- package/dist/native/vertical-video.js.map +1 -1
- package/dist/native/video-player.d.ts +1 -1
- package/dist/native/video-player.js.map +1 -1
- package/dist/native.d.ts +95 -95
- package/dist/native.js +13 -13
- package/dist/native.js.map +1 -1
- package/dist/nav-bar.d.ts +13 -13
- package/dist/nav-bar.js +5 -5
- package/dist/nav-bar.js.map +1 -1
- package/dist/notification-preferences.js +3 -3
- package/dist/number-ticker.d.ts +1 -1
- package/dist/number-ticker.js +1 -1
- package/dist/number-ticker.js.map +1 -1
- package/dist/opening-hours.d.ts +1 -1
- package/dist/opening-hours.js +1 -1
- package/dist/opening-hours.js.map +1 -1
- package/dist/{page-DPHDmDAQ.d.ts → page-Ufnb5TrQ.d.ts} +5 -5
- package/dist/page-header.d.ts +1 -1
- package/dist/page-header.js.map +1 -1
- package/dist/page-hero.d.ts +1 -1
- package/dist/page-hero.js +5 -5
- package/dist/page-hero.js.map +1 -1
- package/dist/page-index.d.ts +1 -1
- package/dist/page-index.js +2 -2
- package/dist/page-index.js.map +1 -1
- package/dist/page.d.ts +1 -1
- package/dist/page.js +3 -3
- package/dist/pagination.d.ts +1 -1
- package/dist/pagination.js +1 -1
- package/dist/pagination.js.map +1 -1
- package/dist/pausable-loop.js +2 -2
- package/dist/{player-lightbox-BYQ57OXT.js → player-lightbox-SJR3GB7U.js} +5 -5
- package/dist/player-lightbox-SJR3GB7U.js.map +1 -0
- package/dist/pointer-light.d.ts +1 -1
- package/dist/pointer-light.js.map +1 -1
- package/dist/popover.d.ts +1 -1
- package/dist/popover.js +1 -1
- package/dist/popover.js.map +1 -1
- package/dist/price-catalogue-editor.js +8 -8
- package/dist/price-catalogue-editor.js.map +1 -1
- package/dist/pricing-page.d.ts +1 -1
- package/dist/pricing-page.js +1 -1
- package/dist/pricing-page.js.map +1 -1
- package/dist/product-page.d.ts +1 -1
- package/dist/product-page.js +1 -1
- package/dist/product-page.js.map +1 -1
- package/dist/profile-card.d.ts +3 -3
- package/dist/profile-card.js +1 -1
- package/dist/profile-card.js.map +1 -1
- package/dist/progress.d.ts +1 -1
- package/dist/progress.js.map +1 -1
- package/dist/promise-card.d.ts +1 -1
- package/dist/promise-card.js +1 -1
- package/dist/promise-card.js.map +1 -1
- package/dist/promo-code-field.js +4 -4
- package/dist/proposal.js +5 -5
- package/dist/qr-code.js +6 -6
- package/dist/qr-code.js.map +1 -1
- package/dist/quota-meter.d.ts +1 -1
- package/dist/quota-meter.js +1 -1
- package/dist/quota-meter.js.map +1 -1
- package/dist/radio-group.d.ts +5 -5
- package/dist/radio-group.js +3 -3
- package/dist/radio-group.js.map +1 -1
- package/dist/rail-nav.d.ts +4 -4
- package/dist/rail-nav.js +3 -3
- package/dist/rail-nav.js.map +1 -1
- package/dist/recipes.js +1 -1
- package/dist/recipes.js.map +1 -1
- package/dist/retro-tv-playlist.d.ts +1 -1
- package/dist/retro-tv-playlist.js.map +1 -1
- package/dist/retro-tv.js +6 -6
- package/dist/retro-tv.js.map +1 -1
- package/dist/reviews.js +3 -3
- package/dist/{schema-Dkn0uX72.d.ts → schema-Dd05m48Q.d.ts} +1 -1
- package/dist/schema-form.js +7 -7
- package/dist/schema-form.js.map +1 -1
- package/dist/scroll-stage.d.ts +2 -2
- package/dist/scroll-stage.js +2 -2
- package/dist/scroll-stage.js.map +1 -1
- package/dist/search-field.d.ts +1 -1
- package/dist/search-field.js +2 -2
- package/dist/section-backdrop.d.ts +1 -1
- package/dist/section-backdrop.js +1 -1
- package/dist/separator.d.ts +1 -1
- package/dist/separator.js.map +1 -1
- package/dist/service-card.d.ts +1 -1
- package/dist/service-card.js +6 -6
- package/dist/service-card.js.map +1 -1
- package/dist/settings-layout.d.ts +3 -3
- package/dist/settings-layout.js +2 -2
- package/dist/shop/booking.d.ts +1 -1
- package/dist/shop/booking.js +4 -4
- package/dist/shop/booking.js.map +1 -1
- package/dist/shop/bulletin.d.ts +1 -1
- package/dist/shop/bulletin.js +2 -2
- package/dist/shop/bulletin.js.map +1 -1
- package/dist/shop/faq.d.ts +1 -1
- package/dist/shop/faq.js +3 -3
- package/dist/shop/faq.js.map +1 -1
- package/dist/shop/gallery.d.ts +1 -1
- package/dist/shop/gallery.js +3 -3
- package/dist/shop/gallery.js.map +1 -1
- package/dist/shop/hero.d.ts +1 -1
- package/dist/shop/hero.js +2 -2
- package/dist/shop/hero.js.map +1 -1
- package/dist/shop/policies.d.ts +1 -1
- package/dist/shop/policies.js +2 -2
- package/dist/shop/policies.js.map +1 -1
- package/dist/shop/reviews.d.ts +1 -1
- package/dist/shop/reviews.js +2 -2
- package/dist/shop/reviews.js.map +1 -1
- package/dist/shop/services.d.ts +1 -1
- package/dist/shop/services.js +4 -4
- package/dist/shop/services.js.map +1 -1
- package/dist/shop/social.d.ts +1 -1
- package/dist/shop/social.js +2 -2
- package/dist/shop/social.js.map +1 -1
- package/dist/shop/story.d.ts +1 -1
- package/dist/shop/story.js +2 -2
- package/dist/shop/story.js.map +1 -1
- package/dist/shop/team.d.ts +1 -1
- package/dist/shop/team.js +2 -2
- package/dist/shop/team.js.map +1 -1
- package/dist/shop/video.d.ts +1 -1
- package/dist/shop/video.js +2 -2
- package/dist/shop/video.js.map +1 -1
- package/dist/shop/visit.d.ts +1 -1
- package/dist/shop/visit.js +2 -2
- package/dist/shop/visit.js.map +1 -1
- package/dist/shop-composer.js +2 -2
- package/dist/shop-composer.js.map +1 -1
- package/dist/shop-gallery.d.ts +1 -1
- package/dist/shop-gallery.js +2 -2
- package/dist/shop-gallery.js.map +1 -1
- package/dist/shop.d.ts +3 -3
- package/dist/shop.js +2 -2
- package/dist/showcase.d.ts +1 -1
- package/dist/showcase.js +6 -6
- package/dist/showcase.js.map +1 -1
- package/dist/signature.d.ts +1 -1
- package/dist/signature.js +2 -2
- package/dist/signature.js.map +1 -1
- package/dist/site-cahier.d.ts +3 -3
- package/dist/site-cahier.js +10 -10
- package/dist/site-cahier.js.map +1 -1
- package/dist/site-footer.d.ts +4 -4
- package/dist/site-footer.js +1 -1
- package/dist/site-footer.js.map +1 -1
- package/dist/skeleton.d.ts +3 -3
- package/dist/skeleton.js.map +1 -1
- package/dist/skip-link.d.ts +1 -1
- package/dist/skip-link.js +1 -1
- package/dist/slider.d.ts +1 -1
- package/dist/slider.js +2 -2
- package/dist/slider.js.map +1 -1
- package/dist/slot-picker.d.ts +1 -1
- package/dist/slot-picker.js +1 -1
- package/dist/slot-picker.js.map +1 -1
- package/dist/specimen-tag.d.ts +2 -2
- package/dist/specimen-tag.js +2 -2
- package/dist/speed-lines.d.ts +1 -1
- package/dist/speed-lines.js +1 -1
- package/dist/speed-lines.js.map +1 -1
- package/dist/spinner.d.ts +2 -2
- package/dist/spinner.js +1 -1
- package/dist/spinner.js.map +1 -1
- package/dist/split-view.d.ts +1 -1
- package/dist/split-view.js.map +1 -1
- package/dist/stage-banner.d.ts +1 -1
- package/dist/stage-banner.js +1 -1
- package/dist/stage-banner.js.map +1 -1
- package/dist/stat.d.ts +2 -2
- package/dist/stat.js +1 -1
- package/dist/status-chip.js +4 -4
- package/dist/status-chip.js.map +1 -1
- package/dist/status-page.d.ts +1 -1
- package/dist/status-page.js.map +1 -1
- package/dist/step-progress.d.ts +1 -1
- package/dist/step-progress.js.map +1 -1
- package/dist/step-showcase.d.ts +2 -2
- package/dist/step-showcase.js +3 -3
- package/dist/step-showcase.js.map +1 -1
- package/dist/stepper.d.ts +1 -1
- package/dist/stepper.js +1 -1
- package/dist/stepper.js.map +1 -1
- package/dist/sticky-action.d.ts +1 -1
- package/dist/sticky-action.js.map +1 -1
- package/dist/stuck.d.ts +1 -1
- package/dist/stuck.js +1 -1
- package/dist/stuck.js.map +1 -1
- package/dist/swipe-deck.d.ts +2 -2
- package/dist/swipe-deck.js.map +1 -1
- package/dist/switch.d.ts +1 -1
- package/dist/switch.js +1 -1
- package/dist/tabs.d.ts +6 -6
- package/dist/tabs.js +1 -1
- package/dist/tabs.js.map +1 -1
- package/dist/tag-input.d.ts +1 -1
- package/dist/tag-input.js +4 -4
- package/dist/tag-input.js.map +1 -1
- package/dist/tag-selector.d.ts +1 -1
- package/dist/tag-selector.js +3 -3
- package/dist/tag-selector.js.map +1 -1
- package/dist/taped-photo.d.ts +1 -1
- package/dist/taped-photo.js +2 -2
- package/dist/terminal-replay.d.ts +1 -1
- package/dist/terminal-replay.js +3 -3
- package/dist/terminal-replay.js.map +1 -1
- package/dist/text-style/server.d.ts +1 -1
- package/dist/text-style/server.js.map +1 -1
- package/dist/text-style.d.ts +2 -2
- package/dist/text-style.js.map +1 -1
- package/dist/theme.d.ts +3 -3
- package/dist/theme.js +3 -3
- package/dist/theme.js.map +1 -1
- package/dist/toast.d.ts +1 -1
- package/dist/toast.js +2 -2
- package/dist/toast.js.map +1 -1
- package/dist/toc.d.ts +2 -2
- package/dist/toc.js +1 -1
- package/dist/toc.js.map +1 -1
- package/dist/tooltip.d.ts +1 -1
- package/dist/tooltip.js +2 -2
- package/dist/tree-view.d.ts +1 -1
- package/dist/tree-view.js +2 -2
- package/dist/tree-view.js.map +1 -1
- package/dist/update-prompt.d.ts +1 -1
- package/dist/update-prompt.js +3 -3
- package/dist/update-prompt.js.map +1 -1
- package/dist/upload-queue.d.ts +2 -2
- package/dist/upload-queue.js +1 -1
- package/dist/upload-queue.js.map +1 -1
- package/dist/usage.d.ts +4 -4
- package/dist/usage.js +3 -3
- package/dist/usage.js.map +1 -1
- package/dist/verified-badge.d.ts +1 -1
- package/dist/verified-badge.js.map +1 -1
- package/dist/versus-card.d.ts +1 -1
- package/dist/versus-card.js +2 -2
- package/dist/versus-card.js.map +1 -1
- package/dist/vertical-video.d.ts +2 -2
- package/dist/vertical-video.js +6 -6
- package/dist/vertical-video.js.map +1 -1
- package/dist/video-player.d.ts +1 -1
- package/dist/video-player.js +5 -5
- package/dist/video-trimmer.d.ts +1 -1
- package/dist/video-trimmer.js.map +1 -1
- package/dist/virtual.d.ts +2 -2
- package/dist/virtual.js +1 -1
- package/dist/wall.js +2 -2
- package/dist/wall.js.map +1 -1
- package/dist/waveform.d.ts +1 -1
- package/dist/waveform.js.map +1 -1
- package/package.json +7 -7
- package/registry/account-settings.json +17 -17
- package/registry/achievement.json +1 -1
- package/registry/action-bar.json +3 -3
- package/registry/activity-feed.json +2 -2
- package/registry/alert.json +1 -1
- package/registry/analysis-report.json +1 -1
- package/registry/anatomy-plate.json +1 -1
- package/registry/app-frame.json +6 -6
- package/registry/app-header.json +4 -4
- package/registry/app-shell.json +2 -2
- package/registry/architecture-diagram.json +1 -1
- package/registry/argument-card.json +3 -3
- package/registry/auth-layout.json +1 -1
- package/registry/avatar.json +3 -3
- package/registry/badge.json +1 -1
- package/registry/bird-plate.json +1 -1
- package/registry/button.json +1 -1
- package/registry/captcha.json +1 -1
- package/registry/card-grid.json +1 -1
- package/registry/card.json +1 -1
- package/registry/catalogue-page.json +1 -1
- package/registry/changelog-page.json +2 -2
- package/registry/chapter.json +2 -2
- package/registry/chat.json +1 -1
- package/registry/checkbox.json +1 -1
- package/registry/chip-link.json +1 -1
- package/registry/chip-row.json +1 -1
- package/registry/chip.json +2 -2
- package/registry/choice-grid.json +2 -2
- package/registry/cn.json +1 -1
- package/registry/code-block.json +2 -2
- package/registry/collection-switcher.json +2 -2
- package/registry/columns.json +1 -1
- package/registry/combobox.json +2 -2
- package/registry/command.json +1 -1
- package/registry/comparison-table.json +1 -1
- package/registry/component-page.json +1 -1
- package/registry/confirm-button.json +1 -1
- package/registry/contact-page.json +1 -1
- package/registry/continue-prompt.json +1 -1
- package/registry/copy-button.json +2 -2
- package/registry/countdown.json +1 -1
- package/registry/cover-hero.json +3 -3
- package/registry/cta-panel.json +1 -1
- package/registry/dashboard-layout.json +2 -2
- package/registry/data-table.json +4 -4
- package/registry/date-picker.json +8 -8
- package/registry/decision-list.json +2 -2
- package/registry/description-list.json +1 -1
- package/registry/detail-layout.json +1 -1
- package/registry/dialog.json +2 -2
- package/registry/docs-article-page.json +1 -1
- package/registry/docs-hub-page.json +1 -1
- package/registry/docs-layout.json +2 -2
- package/registry/docs-nav.json +1 -1
- package/registry/document-viewer.json +2 -2
- package/registry/doodle.json +1 -1
- package/registry/drop-overlay.json +1 -1
- package/registry/dropdown-menu.json +1 -1
- package/registry/empty-state.json +1 -1
- package/registry/engine-flow.json +1 -1
- package/registry/entity-header.json +2 -2
- package/registry/environment-notice.json +1 -1
- package/registry/error-page.json +1 -1
- package/registry/field.json +1 -1
- package/registry/file-upload.json +2 -2
- package/registry/filter-bar.json +4 -4
- package/registry/flock.json +1 -1
- package/registry/footnote.json +1 -1
- package/registry/force-update-screen.json +1 -1
- package/registry/form.json +64 -64
- package/registry/gallery-page.json +1 -1
- package/registry/genui.json +2 -2
- package/registry/glow-card.json +1 -1
- package/registry/goal-gauge.json +1 -1
- package/registry/grade-stamp.json +1 -1
- package/registry/identity-card.json +1 -1
- package/registry/image-cropper.json +1 -1
- package/registry/index.json +8 -8
- package/registry/kanban.json +1 -1
- package/registry/kbd.json +1 -1
- package/registry/kind-config-editor.json +2 -2
- package/registry/kpi-explained.json +1 -1
- package/registry/landing-page.json +1 -1
- package/registry/landscape.json +1 -1
- package/registry/language-switch.json +1 -1
- package/registry/legal-page.json +1 -1
- package/registry/link-card.json +3 -3
- package/registry/list.json +2 -2
- package/registry/loader.json +1 -1
- package/registry/longform-page.json +1 -1
- package/registry/maintenance-screen.json +1 -1
- package/registry/map.json +7 -7
- package/registry/margin-layout.json +1 -1
- package/registry/markdown.json +1 -1
- package/registry/marketing-layout.json +1 -1
- package/registry/mascot-quote.json +1 -1
- package/registry/mascot-state.json +2 -2
- package/registry/mascots.json +3 -3
- package/registry/match-dialog.json +1 -1
- package/registry/media-capture.json +2 -2
- package/registry/media-gallery.json +4 -4
- package/registry/meter.json +1 -1
- package/registry/money-input.json +1 -1
- package/registry/nav-bar.json +8 -8
- package/registry/number-ticker.json +1 -1
- package/registry/opening-hours.json +2 -2
- package/registry/page-header.json +1 -1
- package/registry/page-hero.json +3 -3
- package/registry/page-index.json +2 -2
- package/registry/page.json +1 -1
- package/registry/pagination.json +2 -2
- package/registry/pointer-light.json +1 -1
- package/registry/popover.json +1 -1
- package/registry/price-catalogue-editor.json +1 -1
- package/registry/pricing-page.json +2 -2
- package/registry/product-page.json +1 -1
- package/registry/profile-card.json +3 -3
- package/registry/progress.json +1 -1
- package/registry/promise-card.json +1 -1
- package/registry/qr-code.json +2 -2
- package/registry/quota-meter.json +1 -1
- package/registry/radio-group.json +14 -14
- package/registry/rail-nav.json +8 -8
- package/registry/recipes.json +1 -1
- package/registry/retro-tv.json +3 -3
- package/registry/schema-form.json +1 -1
- package/registry/scroll-stage.json +1 -1
- package/registry/search-field.json +2 -2
- package/registry/section-backdrop.json +1 -1
- package/registry/separator.json +1 -1
- package/registry/service-card.json +3 -3
- package/registry/settings-layout.json +1 -1
- package/registry/shop-composer.json +3 -3
- package/registry/shop-gallery.json +1 -1
- package/registry/shop.json +17 -17
- package/registry/showcase.json +1 -1
- package/registry/signature.json +1 -1
- package/registry/site-cahier.json +2 -2
- package/registry/site-footer.json +10 -10
- package/registry/skeleton.json +1 -1
- package/registry/skip-link.json +1 -1
- package/registry/slider.json +1 -1
- package/registry/slot-picker.json +2 -2
- package/registry/specimen-tag.json +1 -1
- package/registry/speed-lines.json +1 -1
- package/registry/spinner.json +2 -2
- package/registry/split-view.json +1 -1
- package/registry/stage-banner.json +1 -1
- package/registry/stat.json +1 -1
- package/registry/status-chip.json +2 -2
- package/registry/status-page.json +1 -1
- package/registry/step-progress.json +1 -1
- package/registry/step-showcase.json +2 -2
- package/registry/stepper.json +1 -1
- package/registry/sticky-action.json +1 -1
- package/registry/stuck.json +1 -1
- package/registry/swipe-deck.json +1 -1
- package/registry/switch.json +1 -1
- package/registry/tabs.json +1 -1
- package/registry/tag-input.json +1 -1
- package/registry/tag-selector.json +1 -1
- package/registry/taped-photo.json +1 -1
- package/registry/terminal-replay.json +2 -2
- package/registry/text-style.json +8 -8
- package/registry/theme.json +1 -1
- package/registry/toast.json +1 -1
- package/registry/toc.json +1 -1
- package/registry/tooltip.json +1 -1
- package/registry/tree-view.json +2 -2
- package/registry/update-prompt.json +1 -1
- package/registry/upload-queue.json +1 -1
- package/registry/usage.json +2 -2
- package/registry/verified-badge.json +1 -1
- package/registry/versus-card.json +1 -1
- package/registry/vertical-video.json +2 -2
- package/registry/video-player.json +2 -2
- package/registry/video-trimmer.json +1 -1
- package/registry/virtual.json +3 -3
- package/registry/wall.json +1 -1
- package/registry/waveform.json +1 -1
- package/dist/chunk-2FCQCWIK.js.map +0 -1
- package/dist/chunk-43PTCDTL.js.map +0 -1
- package/dist/chunk-5D7NMUF6.js.map +0 -1
- package/dist/chunk-5PFCELGW.js.map +0 -1
- package/dist/chunk-5RWHDX5J.js.map +0 -1
- package/dist/chunk-5VZ37TY3.js.map +0 -1
- package/dist/chunk-757ZTGU5.js.map +0 -1
- package/dist/chunk-7DYZTEE3.js.map +0 -1
- package/dist/chunk-7P7I5OQV.js.map +0 -1
- package/dist/chunk-B47WSPMP.js.map +0 -1
- package/dist/chunk-C57KK5VB.js.map +0 -1
- package/dist/chunk-EB45EVPJ.js.map +0 -1
- package/dist/chunk-EDQLPCM4.js.map +0 -1
- package/dist/chunk-GHAN7OOE.js.map +0 -1
- package/dist/chunk-HLEBSAGC.js.map +0 -1
- package/dist/chunk-HP7BDMVK.js.map +0 -1
- package/dist/chunk-KH3JOEPY.js.map +0 -1
- package/dist/chunk-KR2W4ONJ.js.map +0 -1
- package/dist/chunk-LH5J3VLZ.js.map +0 -1
- package/dist/chunk-LNAAWT4Y.js.map +0 -1
- package/dist/chunk-MDSP7DJR.js.map +0 -1
- package/dist/chunk-NG6G6V5E.js.map +0 -1
- package/dist/chunk-NM2DEHFZ.js.map +0 -1
- package/dist/chunk-NPMGYLJV.js.map +0 -1
- package/dist/chunk-NQENOT6L.js.map +0 -1
- package/dist/chunk-NSLXEDIS.js.map +0 -1
- package/dist/chunk-OGWB76BR.js.map +0 -1
- package/dist/chunk-P7AFIKWG.js.map +0 -1
- package/dist/chunk-PGBF3UBX.js.map +0 -1
- package/dist/chunk-QA3WETWT.js.map +0 -1
- package/dist/chunk-QD6SNXF5.js.map +0 -1
- package/dist/chunk-QHVV2JGF.js.map +0 -1
- package/dist/chunk-QVHSV6RA.js.map +0 -1
- package/dist/chunk-S2O4NSN5.js.map +0 -1
- package/dist/chunk-S4TLZRGZ.js.map +0 -1
- package/dist/chunk-S6NYGOJT.js.map +0 -1
- package/dist/chunk-SB5WSVPI.js.map +0 -1
- package/dist/chunk-SG2RKUVJ.js.map +0 -1
- package/dist/chunk-V5RO6JYI.js.map +0 -1
- package/dist/chunk-V7W4RLRW.js.map +0 -1
- package/dist/chunk-VA4NPCUQ.js.map +0 -1
- package/dist/chunk-VPO27AFS.js.map +0 -1
- package/dist/chunk-W64RAX4N.js.map +0 -1
- package/dist/chunk-W675RFOA.js.map +0 -1
- package/dist/chunk-WC3SO4CE.js.map +0 -1
- package/dist/chunk-WEVYKZIF.js.map +0 -1
- package/dist/chunk-WU4VLSEA.js.map +0 -1
- package/dist/chunk-Y3P5B4XS.js.map +0 -1
- package/dist/chunk-YTYNKMNS.js.map +0 -1
- package/dist/chunk-Z47KIPCT.js.map +0 -1
- package/dist/chunk-ZPOVOEO3.js.map +0 -1
- package/dist/player-lightbox-BYQ57OXT.js.map +0 -1
- /package/dist/{chunk-HJFRHYCI.js.map → chunk-DTGRZXYO.js.map} +0 -0
- /package/dist/{chunk-PJNR4NTS.js.map → chunk-HC2TY45B.js.map} +0 -0
- /package/dist/{lightbox-MRB2YZEP.js.map → lightbox-JLWASIJC.js.map} +0 -0
|
@@ -559,7 +559,7 @@
|
|
|
559
559
|
},
|
|
560
560
|
{
|
|
561
561
|
"name": "mood",
|
|
562
|
-
"type": "\"
|
|
562
|
+
"type": "\"empty\" | \"success\" | \"error\" | \"welcome\" | \"thinking\"",
|
|
563
563
|
"default": "empty",
|
|
564
564
|
"description": "The moment: `empty` (default), `thinking`, `success`, `error`, `welcome`.",
|
|
565
565
|
"required": false
|
|
@@ -851,7 +851,7 @@
|
|
|
851
851
|
},
|
|
852
852
|
{
|
|
853
853
|
"path": "mascot-state/mascot-state.tsx",
|
|
854
|
-
"content": "// The moments a product speaks to a person — nothing yet, a long wait, done, it failed, welcome — told by a bird of\n// the flock beside the words. Every word is a prop; the bird never carries the message alone.\nimport type * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport type { MascotBird, MascotMood, MascotTone } from \"../mascots/geometry\";\nimport { Mascot } from \"../mascots/mascot\";\n\n// Staged: the bird arrives, then the words, then the action — once, and not at all under reduced motion.\nconst CSS = `\n@keyframes kzms-in { from { opacity: 0; transform: translateY(6px); } }\n@media (prefers-reduced-motion: no-preference) {\n [data-kzms-staged] > [data-kzms-part] { animation: kzms-in .42s cubic-bezier(.2,.8,.2,1) both; }\n [data-kzms-staged] > [data-kzms-part=\"words\"] { animation-delay: .12s; }\n [data-kzms-staged] > [data-kzms-part=\"action\"] { animation-delay: .24s; }\n}\n`;\n\nexport const mascotState = tv({\n slots: {\n root: \"flex items-center gap-4 text-fg\",\n bird: \"shrink-0\",\n words: \"flex flex-col gap-1.5\",\n title: \"text-base font-semibold text-fg\",\n description: \"max-w-sm text-sm text-fg-secondary\",\n action: \"flex flex-wrap items-center gap-2\",\n },\n variants: {\n layout: {\n stacked: { root: \"flex-col justify-center px-6 py-10 text-center\", words: \"items-center\", action: \"justify-center\" },\n inline: { root: \"flex-row text-left\", action: \"mt-1\" },\n },\n framed: { true: { root: \"rounded-xl border border-dashed border-border-default bg-surface-1\" }, false: {} },\n },\n compoundVariants: [{ layout: \"inline\", framed: true, class: { root: \"p-4\" } }],\n defaultVariants: { layout: \"stacked\", framed: false },\n});\n\nconst SIZE = { sm: 64, md: 96, lg: 128 } as const;\n\nexport type MascotStateProps = Omit<React.ComponentProps<\"div\">, \"title\"> & {\n /**\n * The bird whose job the moment is about: `owl` (documents, reading), `falcon` (security, verification), `duck`\n * (code, building), `flamingo` (answers, payments), `pigeon` (delivery, notifications), `lovebird` (introductions), `crane` (listening), `magpie` (score, standings), `beaver` (the shop). One bird per idea.\n */\n bird?: MascotBird;\n /** The moment: `empty` (nothing yet), `thinking` (a long task runs), `success` (done), `error` (it failed), `welcome`. */\n mood?: MascotMood;\n /** What happened, in a few words (\"No videos yet\", \"Payment received\"). */\n title: React.ReactNode;\n /** Why, or what comes next. */\n description?: React.ReactNode;\n /** What to do next: a Button, a link. One, at most two. */\n action?: React.ReactNode;\n /** The bird's size: `sm` 64 px, `md` 96 px (default), `lg` 128 px. */\n size?: keyof typeof SIZE;\n /** `stacked` (default): the bird above centred words — a page, a panel. `inline`: the bird beside the words — a card, a row of a form. */\n layout?: \"stacked\" | \"inline\";\n /** A dashed frame on the raised surface, for an empty list or panel. */\n framed?: boolean;\n /** `brand` (default): the product's accent. `own`: the bird's colours of the Krizaka story. */\n tone?: MascotTone;\n /** The bird's gesture and the staged arrival. Off with `false`; always off under `prefers-reduced-motion`. */\n animated?: boolean;\n /** The level of the title (default `p`): `h1` on a full page (a 404), `h2`/`h3` inside a page. */\n titleAs?: \"p\" | \"h1\" | \"h2\" | \"h3\";\n};\n\n/**\n * A moment told by a bird of the flock: an empty list, a long wait, a success, an error, a welcome. Announced to\n * assistive technology — `role=\"alert\"` for an error, `role=\"status\"` otherwise (`aria-busy` while thinking).\n */\nexport function MascotState({\n bird = \"owl\",\n mood = \"empty\",\n title,\n description,\n action,\n size = \"md\",\n layout,\n framed,\n tone,\n animated = true,\n titleAs: Title = \"p\",\n className,\n ...props\n}: MascotStateProps) {\n const s = mascotState({ layout, framed });\n return (\n <div\n role={mood === \"error\" ? \"alert\" : \"status\"}\n aria-busy={mood === \"thinking\" ? true : undefined}\n data-mood={mood}\n data-kzms-staged={animated ? \"\" : undefined}\n className={s.root({ className })}\n {...props}\n >\n {animated && <style>{CSS}</style>}\n <span data-kzms-part=\"bird\" className={s.bird()}>\n <Mascot bird={bird} mood={mood} tone={tone} size={SIZE[size]} animated={animated} />\n </span>\n <div data-kzms-part=\"words\" className={s.words()}>\n <Title className={s.title()}>{title}</Title>\n {description && <p className={s.description()}>{description}</p>}\n {layout === \"inline\" && action && <div className={s.action()}>{action}</div>}\n </div>\n {layout !== \"inline\" && action && (\n <div data-kzms-part=\"action\" className={s.action()}>\n {action}\n </div>\n )}\n </div>\n );\n}\n\ntype PresetProps = Omit<MascotStateProps, \"mood\">;\n\n/** It failed: what went wrong and what to do (`role=\"alert\"`). `MascotState` with `mood=\"error\"`. */\nexport function ErrorState(props: PresetProps) {\n return <MascotState mood=\"error\" {...props} />;\n}\n\n/** It is done: a payment, a verification, a delivery, a sent message. `MascotState` with `mood=\"success\"`. */\nexport function SuccessState(props: PresetProps) {\n return <MascotState mood=\"success\" {...props} />;\n}\n\n/** A long task runs (`aria-busy`): what runs, beside the bird. `MascotState` with `mood=\"thinking\"`. */\nexport function LoadingState(props: PresetProps) {\n return <MascotState mood=\"thinking\" {...props} />;\n}\n\n/** A first screen, an onboarding step. `MascotState` with `mood=\"welcome\"`. */\nexport function WelcomeState(props: PresetProps) {\n return <MascotState mood=\"welcome\" {...props} />;\n}\n"
|
|
854
|
+
"content": "// The moments a product speaks to a person — nothing yet, a long wait, done, it failed, welcome — told by a bird of\n// the flock beside the words. Every word is a prop; the bird never carries the message alone.\nimport type * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport type { MascotBird, MascotMood, MascotTone } from \"../mascots/geometry\";\nimport { Mascot } from \"../mascots/mascot\";\n\n// Staged: the bird arrives, then the words, then the action — once, and not at all under reduced motion.\nconst CSS = `\n@keyframes kzms-in { from { opacity: 0; transform: translateY(6px); } }\n@media (prefers-reduced-motion: no-preference) {\n [data-kzms-staged] > [data-kzms-part] { animation: kzms-in .42s cubic-bezier(.2,.8,.2,1) both; }\n [data-kzms-staged] > [data-kzms-part=\"words\"] { animation-delay: .12s; }\n [data-kzms-staged] > [data-kzms-part=\"action\"] { animation-delay: .24s; }\n}\n`;\n\nexport const mascotState = tv({\n slots: {\n root: \"flex items-center gap-4 text-fg\",\n bird: \"shrink-0\",\n words: \"flex flex-col gap-1.5\",\n title: \"text-base font-semibold text-fg\",\n description: \"max-w-sm text-sm text-fg-secondary\",\n action: \"flex flex-wrap items-center gap-2\",\n },\n variants: {\n layout: {\n stacked: { root: \"flex-col justify-center px-6 py-10 text-center\", words: \"items-center\", action: \"justify-center\" },\n inline: { root: \"flex-row text-left\", action: \"mt-1\" },\n },\n framed: { true: { root: \"rounded-xl border border-dashed border-border-default bg-surface-1\" }, false: {} },\n },\n compoundVariants: [{ layout: \"inline\", framed: true, class: { root: \"p-4\" } }],\n defaultVariants: { layout: \"stacked\", framed: false },\n});\n\nconst SIZE = { sm: 64, md: 96, lg: 128 } as const;\n\nexport type MascotStateProps = Omit<React.ComponentProps<\"div\">, \"title\"> & {\n /**\n * The bird whose job the moment is about: `owl` (documents, reading), `falcon` (security, verification), `duck`\n * (code, building), `flamingo` (answers, payments), `pigeon` (delivery, notifications), `lovebird` (introductions), `crane` (listening), `magpie` (score, standings), `beaver` (the shop). One bird per idea.\n */\n bird?: MascotBird;\n /** The moment: `empty` (nothing yet), `thinking` (a long task runs), `success` (done), `error` (it failed), `welcome`. */\n mood?: MascotMood;\n /** What happened, in a few words (\"No videos yet\", \"Payment received\"). */\n title: React.ReactNode;\n /** Why, or what comes next. */\n description?: React.ReactNode;\n /** What to do next: a Button, a link. One, at most two. */\n action?: React.ReactNode;\n /** The bird's size: `sm` 64 px, `md` 96 px (default), `lg` 128 px. */\n size?: keyof typeof SIZE;\n /** `stacked` (default): the bird above centred words — a page, a panel. `inline`: the bird beside the words — a card, a row of a form. */\n layout?: \"stacked\" | \"inline\";\n /** A dashed frame on the raised surface, for an empty list or panel. */\n framed?: boolean;\n /** `brand` (default): the product's accent. `own`: the bird's colours of the Krizaka story. */\n tone?: MascotTone;\n /** The bird's gesture and the staged arrival. Off with `false`; always off under `prefers-reduced-motion`. */\n animated?: boolean;\n /** The level of the title (default `p`): `h1` on a full page (a 404), `h2`/`h3` inside a page. */\n titleAs?: \"p\" | \"h1\" | \"h2\" | \"h3\";\n};\n\n/**\n * A moment told by a bird of the flock: an empty list, a long wait, a success, an error, a welcome. Announced to\n * assistive technology — `role=\"alert\"` for an error, `role=\"status\"` otherwise (`aria-busy` while thinking).\n */\nexport function MascotState({\n bird = \"owl\",\n mood = \"empty\",\n title,\n description,\n action,\n size = \"md\",\n layout,\n framed,\n tone,\n animated = true,\n titleAs: Title = \"p\",\n className,\n ...props\n}: Readonly<MascotStateProps>) {\n const s = mascotState({ layout, framed });\n return (\n <div\n role={mood === \"error\" ? \"alert\" : \"status\"}\n aria-busy={mood === \"thinking\" ? true : undefined}\n data-mood={mood}\n data-kzms-staged={animated ? \"\" : undefined}\n className={s.root({ className })}\n {...props}\n >\n {animated && <style>{CSS}</style>}\n <span data-kzms-part=\"bird\" className={s.bird()}>\n <Mascot bird={bird} mood={mood} tone={tone} size={SIZE[size]} animated={animated} />\n </span>\n <div data-kzms-part=\"words\" className={s.words()}>\n <Title className={s.title()}>{title}</Title>\n {description && <p className={s.description()}>{description}</p>}\n {layout === \"inline\" && action && <div className={s.action()}>{action}</div>}\n </div>\n {layout !== \"inline\" && action && (\n <div data-kzms-part=\"action\" className={s.action()}>\n {action}\n </div>\n )}\n </div>\n );\n}\n\ntype PresetProps = Omit<MascotStateProps, \"mood\">;\n\n/** It failed: what went wrong and what to do (`role=\"alert\"`). `MascotState` with `mood=\"error\"`. */\nexport function ErrorState(props: Readonly<PresetProps>) {\n return <MascotState mood=\"error\" {...props} />;\n}\n\n/** It is done: a payment, a verification, a delivery, a sent message. `MascotState` with `mood=\"success\"`. */\nexport function SuccessState(props: Readonly<PresetProps>) {\n return <MascotState mood=\"success\" {...props} />;\n}\n\n/** A long task runs (`aria-busy`): what runs, beside the bird. `MascotState` with `mood=\"thinking\"`. */\nexport function LoadingState(props: Readonly<PresetProps>) {\n return <MascotState mood=\"thinking\" {...props} />;\n}\n\n/** A first screen, an onboarding step. `MascotState` with `mood=\"welcome\"`. */\nexport function WelcomeState(props: Readonly<PresetProps>) {\n return <MascotState mood=\"welcome\" {...props} />;\n}\n"
|
|
855
855
|
},
|
|
856
856
|
{
|
|
857
857
|
"path": "mascot-state/meta.ts",
|
package/registry/mascots.json
CHANGED
|
@@ -316,7 +316,7 @@
|
|
|
316
316
|
},
|
|
317
317
|
{
|
|
318
318
|
"name": "mood",
|
|
319
|
-
"type": "\"
|
|
319
|
+
"type": "\"empty\" | \"success\" | \"error\" | \"welcome\" | \"thinking\"",
|
|
320
320
|
"default": "welcome",
|
|
321
321
|
"description": "What the moment is: `welcome`, `thinking`, `success`, `empty` or `error`.",
|
|
322
322
|
"required": false
|
|
@@ -418,7 +418,7 @@
|
|
|
418
418
|
},
|
|
419
419
|
{
|
|
420
420
|
"path": "mascots/mascot.tsx",
|
|
421
|
-
"content": "// The Krizaka flock on the web: one bird, one mood, drawn from ./geometry in the host's brand colours.\nimport type * as React from \"react\";\nimport { useId } from \"react\";\n\nimport { archEye, BIRDS, brow, lidEye, LIGHT, type MascotBird, type MascotMood, type MascotPalette, type MascotTone, MOOD_PARTS, OWN_PALETTES, PARCEL, SHADE, upperLid } from \"./geometry\";\nimport { type MascotLook, phaseOf } from \"./life\";\n\nconst CSS = `\n.kzb-bird { transform-box: view-box; transform-origin: 60px 108px; }\n.kzb-eye { transform-box: fill-box; transform-origin: center; }\n.kzb-wing { transform-box: view-box; }\n[data-animated] .kzb-bird { animation: kzb-bob 3.6s ease-in-out infinite; }\n[data-animated] .kzb-blink { animation: kzb-blink 5.2s ease-in-out infinite; }\n[data-animated][data-mood=\"welcome\"] .kzb-wing-r { animation: kzb-wave 1.1s ease-in-out infinite alternate; }\n[data-animated][data-mood=\"thinking\"] .kzb-dot { animation: kzb-dot 1.5s ease-in-out infinite; }\n[data-animated][data-mood=\"thinking\"] .kzb-dot:nth-child(2) { animation-delay: .2s; }\n[data-animated][data-mood=\"thinking\"] .kzb-dot:nth-child(3) { animation-delay: .4s; }\n[data-animated][data-mood=\"success\"] .kzb-bird { animation: kzb-hop 1.6s cubic-bezier(.3,1.6,.5,1) 1, kzb-bob 3.6s ease-in-out 1.6s infinite; }\n[data-animated][data-mood=\"success\"] .kzb-badge { animation: kzb-pop .5s cubic-bezier(.3,1.6,.5,1) .3s both; }\n[data-animated][data-mood=\"success\"] .kzb-sparkle { animation: kzb-twinkle 2.4s ease-in-out infinite; }\n[data-animated][data-mood=\"error\"] .kzb-bird { animation: kzb-shake .5s ease-in-out .2s 2, kzb-bob 3.6s ease-in-out 1.2s infinite; }\n[data-animated][data-mood=\"empty\"] .kzb-bird { animation: kzb-sway 5s ease-in-out infinite; }\n.kzb-badge, .kzb-sparkle, .kzb-dot { transform-box: fill-box; transform-origin: center; }\n@keyframes kzb-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2.5px); } }\n@keyframes kzb-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }\n@keyframes kzb-wave { from { transform: rotate(-8deg); } to { transform: rotate(-38deg); } }\n@keyframes kzb-dot { 0%, 100% { opacity: .35; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-2px); } }\n@keyframes kzb-hop { 0% { transform: translateY(0); } 30% { transform: translateY(-9px); } 60% { transform: translateY(0); } 100% { transform: translateY(0); } }\n@keyframes kzb-pop { from { transform: scale(0); } to { transform: scale(1); } }\n@keyframes kzb-twinkle { 0%, 100% { opacity: .25; transform: scale(.7); } 50% { opacity: 1; transform: scale(1); } }\n@keyframes kzb-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }\n@keyframes kzb-sway { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-2deg); } }\n@media (prefers-reduced-motion: reduce) {\n .kzb-bird, .kzb-blink, .kzb-wing, .kzb-wing-r, .kzb-hop, .kzb-head, .kzb-parcel, .kzb-dot, .kzb-badge, .kzb-sparkle { animation: none !important; }\n .kzb-look, .kzb-pupil { transition: none !important; transform: none !important; }\n}\n`;\n\n/** The host's roles (`tone=\"brand\"`): the accent paints the bird, so it wears the product it is shown in. */\nconst BRAND: MascotPalette = {\n from: \"var(--kz-accent-2, var(--kz-accent))\",\n to: \"var(--kz-accent)\",\n wing: \"var(--kz-accent)\",\n detail: \"var(--kz-accent-2, var(--kz-accent))\",\n beak: \"var(--kz-warning)\",\n eye: \"var(--kz-text-primary)\",\n};\nconst OUTLINE = \"var(--kz-border-strong, color-mix(in srgb, currentColor 35%, transparent))\";\nconst SURFACE = \"var(--kz-surface-0)\";\n\nexport type MascotProps = Omit<React.ComponentProps<\"svg\">, \"children\"> & {\n /** Which bird of the flock: `falcon` (watch, security), `owl` (reading, documents), `duck` (building, code), `flamingo` (answers, support), `pigeon` (delivery, notifications), `lovebird` (introductions, two people who meet), `crane` (listening, a calm moment), `magpie` (the score: points, standings, trophies), `beaver` (the shop: a small business at work). */\n bird?: MascotBird;\n /** What the moment is: `welcome` (onboarding), `thinking` (a long task running), `success` (it is done), `empty` (nothing here yet), `error` (it failed). */\n mood?: MascotMood;\n /** `brand` (default): the host's accent, so the bird wears the product it is in. `own`: the bird's signature colours of the Krizaka story. */\n tone?: MascotTone;\n /** Width and height in pixels. */\n size?: number;\n /** A light idle motion and the mood's gesture. Off with `false`; always off under `prefers-reduced-motion`. */\n animated?: boolean;\n /** An accessible name (the bird becomes an image); without it the mascot is decorative. */\n title?: string;\n /**\n * The bird at ease, in character (mood `welcome`, the default): it breathes, blinks in its own rhythm, tilts its head,\n * ruffles a wing, now and then hops — the falcon watches, the owl reads, the duck builds, the flamingo answers, the\n * pigeon delivers. CSS only, still under `prefers-reduced-motion` and with `animated={false}`.\n */\n life?: boolean;\n /** Where in its cycles the bird starts, 0 to 1 (default: from the instance's id), so two birds never move together. */\n phase?: number;\n /** Where it looks (`life`): `left` and `right` turn the head and the eyes, `up` raises them, `center` rests. */\n look?: MascotLook;\n /** In flight (`life`): the wings beat, the body leans into the trip — the pigeon of a delivery. */\n flying?: boolean;\n /** Which way it leans in flight, -1 (left) to 1 (right). */\n bank?: number;\n /** Whether the pigeon holds its parcel (default `true`): a flock hands it over and the bird flies back light. */\n carrying?: boolean;\n /** A tap or a poke just happened (`life`): a small jump. Set it for a moment, then unset. */\n poked?: boolean;\n};\n\n/**\n * One of the nine Krizaka figures in one mood — for the moments a product speaks to a person: a welcome, a long wait,\n * a success, an empty list, an error. Drawn in the host's brand colours by default (`tone=\"own\"` for the story's).\n */\nexport function Mascot({ bird = \"owl\", mood = \"welcome\", tone = \"brand\", size = 96, animated = true, title, life = false, phase, look, flying, bank, poked, carrying = true, className, style, ...props }: MascotProps) {\n const uid = useId().replace(/[^a-zA-Z0-9_-]/g, \"\");\n const g = BIRDS[bird];\n const alive = life && mood === \"welcome\";\n const ph = phase ?? phaseOf(uid);\n const p = tone === \"own\" ? OWN_PALETTES[bird] : BRAND;\n const body = `url(#kzb-${uid})`;\n const line = { stroke: OUTLINE, strokeWidth: 1.4, strokeLinejoin: \"round\" as const };\n const eyeR = g.eyes.white || g.eyes.pupil * 1.2;\n const eyes = g.eyes.at.map((at, i) => {\n const glance = mood === \"thinking\" ? 1.4 : 0;\n if (mood === \"success\") return <path key={i} d={archEye(at, eyeR * 0.85)} stroke={g.visor ? p.eye : OUTLINE} strokeWidth={2.2} strokeLinecap=\"round\" fill=\"none\" />;\n if (mood === \"empty\" && g.eyes.white > 0)\n return (\n <g key={i}>\n <circle cx={at[0]} cy={at[1]} r={g.eyes.white} fill={LIGHT} {...line} />\n <circle cx={at[0]} cy={at[1] + g.eyes.pupil * 0.7} r={g.eyes.pupil} fill={SHADE} />\n <path d={upperLid(at, g.eyes.white)} fill={p.detail} {...line} />\n </g>\n );\n if (mood === \"empty\") return <path key={i} d={lidEye(at, eyeR * 0.8)} stroke={g.visor ? p.eye : OUTLINE} strokeWidth={2.2} strokeLinecap=\"round\" fill=\"none\" />;\n return (\n <g key={i} className=\"kzb-eye kzb-blink\">\n {g.eyes.white > 0 && <circle cx={at[0]} cy={at[1]} r={g.eyes.white} fill={LIGHT} {...line} />}\n <g className=\"kzb-pupil\">\n <circle cx={at[0] + glance} cy={at[1] - glance} r={g.eyes.pupil} fill={g.visor ? p.eye : SHADE} />\n {g.eyes.white > 0 && <circle cx={at[0] + glance - g.eyes.pupil * 0.35} cy={at[1] - glance - g.eyes.pupil * 0.35} r={g.eyes.pupil * 0.35} fill={LIGHT} />}\n </g>\n </g>\n );\n });\n const [wl, wr] = g.wings;\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 120 120\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n data-bird={bird}\n data-mood={mood}\n data-animated={animated ? \"\" : undefined}\n data-life={alive ? \"\" : undefined}\n data-look={alive && look && look !== \"center\" ? look : undefined}\n data-flying={alive && flying ? \"\" : undefined}\n data-poked={alive && poked ? \"\" : undefined}\n className={className}\n style={alive ? ({ \"--kzb-ph\": ph, \"--kzb-bank\": bank ?? 0, ...style } as React.CSSProperties) : style}\n {...(title ? { role: \"img\", \"aria-label\": title } : { \"aria-hidden\": true })}\n {...props}\n >\n <style>{CSS}</style>\n <defs>\n <linearGradient id={`kzb-${uid}`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" style={{ stopColor: p.from }} />\n <stop offset=\"100%\" style={{ stopColor: p.to }} />\n </linearGradient>\n </defs>\n <ellipse cx={g.shadow[0]} cy={g.shadow[1]} rx={g.shadow[2]} ry={g.shadow[3]} fill={SHADE} opacity={0.14} />\n {mood === \"empty\" && <path d={MOOD_PARTS.tray} stroke={OUTLINE} strokeWidth={1.6} strokeDasharray=\"3 3\" strokeLinejoin=\"round\" />}\n <g className=\"kzb-hop\">\n <g className=\"kzb-bird\">\n {g.legs.map((d) => (\n <path key={d} d={d} stroke={p.beak} strokeWidth={2.6} strokeLinecap=\"round\" />\n ))}\n {g.back?.map((d) => (d.endsWith(\"Z\") ? <path key={d} d={d} fill={p.detail} {...line} /> : <path key={d} d={d} stroke={OUTLINE} strokeWidth={1.4} />))}\n {g.parcel && carrying && (\n <g className=\"kzb-parcel\" {...line}>\n {g.parcel.map((d, i) => (\n <path key={d} d={d} fill={PARCEL[i]} />\n ))}\n </g>\n )}\n <path d={g.body} fill={body} {...line} />\n <path d={g.belly} fill={LIGHT} opacity={0.28} />\n {[wl, wr].map((w, i) => {\n let turn = 0;\n if (mood === \"success\") turn = i === 0 ? 28 : -28;\n else if (mood === \"welcome\" && i === 1 && !alive) turn = -20;\n return (\n <g key={i === 1 ? \"right\" : \"left\"} className={i === 1 ? \"kzb-wing kzb-wing-r\" : \"kzb-wing kzb-wing-l\"} style={{ transformOrigin: `${w.pivot[0]}px ${w.pivot[1]}px`, transform: turn ? `rotate(${turn}deg)` : undefined }}>\n <path d={w.d} fill={p.wing} {...line} />\n <path d={w.d} fill={SHADE} opacity={0.16} />\n </g>\n );\n })}\n <g className=\"kzb-look\">\n <g className=\"kzb-head\">\n {g.neck && <path d={g.neck.d} stroke={body} strokeWidth={g.neck.width} strokeLinecap=\"round\" />}\n {g.head.r > 0 && <circle cx={g.head.cx} cy={g.head.cy} r={g.head.r} fill={body} {...line} />}\n {g.details.map((d) => (\n <path key={d} d={d} fill={p.detail} {...line} />\n ))}\n {g.visor && <rect x={g.visor.x} y={g.visor.y} width={g.visor.w} height={g.visor.h} rx={4} fill={SURFACE} {...line} />}\n {eyes}\n {g.glasses && (\n <g stroke={OUTLINE} strokeWidth={1.3}>\n {g.eyes.at.map(([x, y]) => (\n <circle key={x} cx={x} cy={y} r={6.5} fill={LIGHT} fillOpacity={0.12} />\n ))}\n <path d={`M${g.eyes.at[0][0] + 6.5} ${g.eyes.at[0][1]} L${g.eyes.at[1][0] - 6.5} ${g.eyes.at[1][1]}`} />\n </g>\n )}\n {mood === \"error\" &&\n g.eyes.at.map((at, i) => <path key={i} d={brow(at, eyeR, g.eyes.at.length === 1 ? 1 : i === 0 ? -1 : 1)} stroke={OUTLINE} strokeWidth={2} strokeLinecap=\"round\" />)}\n <path d={g.beak} fill={p.beak} {...line} />\n </g>\n </g>\n </g>\n </g>\n {mood === \"thinking\" && (\n <g>\n {MOOD_PARTS.dots.map(([cx, cy, r]) => (\n <circle key={cx} className=\"kzb-dot\" cx={cx} cy={cy} r={r} fill=\"var(--kz-text-secondary)\" />\n ))}\n </g>\n )}\n {mood === \"success\" && (\n <>\n {MOOD_PARTS.sparkles.map((d) => (\n <path key={d} className=\"kzb-sparkle\" d={d} fill={p.from} />\n ))}\n <g className=\"kzb-badge\">\n <circle cx={MOOD_PARTS.badge.cx} cy={MOOD_PARTS.badge.cy} r={MOOD_PARTS.badge.r} fill=\"var(--kz-success)\" />\n <path d={MOOD_PARTS.check} stroke={SURFACE} strokeWidth={2.6} strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </g>\n </>\n )}\n {mood === \"error\" && (\n <g className=\"kzb-badge\">\n <circle cx={MOOD_PARTS.badge.cx} cy={MOOD_PARTS.badge.cy} r={MOOD_PARTS.badge.r} fill=\"var(--kz-danger)\" />\n <path d={MOOD_PARTS.bang.line} stroke={SURFACE} strokeWidth={2.8} strokeLinecap=\"round\" />\n <circle cx={MOOD_PARTS.bang.dot[0]} cy={MOOD_PARTS.bang.dot[1]} r={1.6} fill={SURFACE} />\n </g>\n )}\n </svg>\n );\n}\n"
|
|
421
|
+
"content": "// The Krizaka flock on the web: one bird, one mood, drawn from ./geometry in the host's brand colours.\nimport type * as React from \"react\";\nimport { useId } from \"react\";\n\nimport { archEye, BIRDS, brow, lidEye, LIGHT, type MascotBird, type MascotMood, type MascotPalette, type MascotTone, MOOD_PARTS, OWN_PALETTES, PARCEL, SHADE, upperLid } from \"./geometry\";\nimport { type MascotLook, phaseOf } from \"./life\";\n\nconst CSS = `\n.kzb-bird { transform-box: view-box; transform-origin: 60px 108px; }\n.kzb-eye { transform-box: fill-box; transform-origin: center; }\n.kzb-wing { transform-box: view-box; }\n[data-animated] .kzb-bird { animation: kzb-bob 3.6s ease-in-out infinite; }\n[data-animated] .kzb-blink { animation: kzb-blink 5.2s ease-in-out infinite; }\n[data-animated][data-mood=\"welcome\"] .kzb-wing-r { animation: kzb-wave 1.1s ease-in-out infinite alternate; }\n[data-animated][data-mood=\"thinking\"] .kzb-dot { animation: kzb-dot 1.5s ease-in-out infinite; }\n[data-animated][data-mood=\"thinking\"] .kzb-dot:nth-child(2) { animation-delay: .2s; }\n[data-animated][data-mood=\"thinking\"] .kzb-dot:nth-child(3) { animation-delay: .4s; }\n[data-animated][data-mood=\"success\"] .kzb-bird { animation: kzb-hop 1.6s cubic-bezier(.3,1.6,.5,1) 1, kzb-bob 3.6s ease-in-out 1.6s infinite; }\n[data-animated][data-mood=\"success\"] .kzb-badge { animation: kzb-pop .5s cubic-bezier(.3,1.6,.5,1) .3s both; }\n[data-animated][data-mood=\"success\"] .kzb-sparkle { animation: kzb-twinkle 2.4s ease-in-out infinite; }\n[data-animated][data-mood=\"error\"] .kzb-bird { animation: kzb-shake .5s ease-in-out .2s 2, kzb-bob 3.6s ease-in-out 1.2s infinite; }\n[data-animated][data-mood=\"empty\"] .kzb-bird { animation: kzb-sway 5s ease-in-out infinite; }\n.kzb-badge, .kzb-sparkle, .kzb-dot { transform-box: fill-box; transform-origin: center; }\n@keyframes kzb-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2.5px); } }\n@keyframes kzb-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }\n@keyframes kzb-wave { from { transform: rotate(-8deg); } to { transform: rotate(-38deg); } }\n@keyframes kzb-dot { 0%, 100% { opacity: .35; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-2px); } }\n@keyframes kzb-hop { 0% { transform: translateY(0); } 30% { transform: translateY(-9px); } 60% { transform: translateY(0); } 100% { transform: translateY(0); } }\n@keyframes kzb-pop { from { transform: scale(0); } to { transform: scale(1); } }\n@keyframes kzb-twinkle { 0%, 100% { opacity: .25; transform: scale(.7); } 50% { opacity: 1; transform: scale(1); } }\n@keyframes kzb-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }\n@keyframes kzb-sway { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-2deg); } }\n@media (prefers-reduced-motion: reduce) {\n .kzb-bird, .kzb-blink, .kzb-wing, .kzb-wing-r, .kzb-hop, .kzb-head, .kzb-parcel, .kzb-dot, .kzb-badge, .kzb-sparkle { animation: none !important; }\n .kzb-look, .kzb-pupil { transition: none !important; transform: none !important; }\n}\n`;\n\n/** The host's roles (`tone=\"brand\"`): the accent paints the bird, so it wears the product it is shown in. */\nconst BRAND: MascotPalette = {\n from: \"var(--kz-accent-2, var(--kz-accent))\",\n to: \"var(--kz-accent)\",\n wing: \"var(--kz-accent)\",\n detail: \"var(--kz-accent-2, var(--kz-accent))\",\n beak: \"var(--kz-warning)\",\n eye: \"var(--kz-text-primary)\",\n};\nconst OUTLINE = \"var(--kz-border-strong, color-mix(in srgb, currentColor 35%, transparent))\";\nconst SURFACE = \"var(--kz-surface-0)\";\n\nexport type MascotProps = Omit<React.ComponentProps<\"svg\">, \"children\"> & {\n /** Which bird of the flock: `falcon` (watch, security), `owl` (reading, documents), `duck` (building, code), `flamingo` (answers, support), `pigeon` (delivery, notifications), `lovebird` (introductions, two people who meet), `crane` (listening, a calm moment), `magpie` (the score: points, standings, trophies), `beaver` (the shop: a small business at work). */\n bird?: MascotBird;\n /** What the moment is: `welcome` (onboarding), `thinking` (a long task running), `success` (it is done), `empty` (nothing here yet), `error` (it failed). */\n mood?: MascotMood;\n /** `brand` (default): the host's accent, so the bird wears the product it is in. `own`: the bird's signature colours of the Krizaka story. */\n tone?: MascotTone;\n /** Width and height in pixels. */\n size?: number;\n /** A light idle motion and the mood's gesture. Off with `false`; always off under `prefers-reduced-motion`. */\n animated?: boolean;\n /** An accessible name (the bird becomes an image); without it the mascot is decorative. */\n title?: string;\n /**\n * The bird at ease, in character (mood `welcome`, the default): it breathes, blinks in its own rhythm, tilts its head,\n * ruffles a wing, now and then hops — the falcon watches, the owl reads, the duck builds, the flamingo answers, the\n * pigeon delivers. CSS only, still under `prefers-reduced-motion` and with `animated={false}`.\n */\n life?: boolean;\n /** Where in its cycles the bird starts, 0 to 1 (default: from the instance's id), so two birds never move together. */\n phase?: number;\n /** Where it looks (`life`): `left` and `right` turn the head and the eyes, `up` raises them, `center` rests. */\n look?: MascotLook;\n /** In flight (`life`): the wings beat, the body leans into the trip — the pigeon of a delivery. */\n flying?: boolean;\n /** Which way it leans in flight, -1 (left) to 1 (right). */\n bank?: number;\n /** Whether the pigeon holds its parcel (default `true`): a flock hands it over and the bird flies back light. */\n carrying?: boolean;\n /** A tap or a poke just happened (`life`): a small jump. Set it for a moment, then unset. */\n poked?: boolean;\n};\n\n/**\n * One of the nine Krizaka figures in one mood — for the moments a product speaks to a person: a welcome, a long wait,\n * a success, an empty list, an error. Drawn in the host's brand colours by default (`tone=\"own\"` for the story's).\n */\nexport function Mascot({ bird = \"owl\", mood = \"welcome\", tone = \"brand\", size = 96, animated = true, title, life = false, phase, look, flying, bank, poked, carrying = true, className, style, ...props }: Readonly<MascotProps>) {\n const uid = useId().replaceAll(/[^a-zA-Z0-9_-]/g, \"\");\n const g = BIRDS[bird];\n const alive = life && mood === \"welcome\";\n const ph = phase ?? phaseOf(uid);\n const p = tone === \"own\" ? OWN_PALETTES[bird] : BRAND;\n const body = `url(#kzb-${uid})`;\n const line = { stroke: OUTLINE, strokeWidth: 1.4, strokeLinejoin: \"round\" as const };\n const eyeR = g.eyes.white || g.eyes.pupil * 1.2;\n const eyes = g.eyes.at.map((at, i) => {\n const glance = mood === \"thinking\" ? 1.4 : 0;\n if (mood === \"success\") return <path key={i} d={archEye(at, eyeR * 0.85)} stroke={g.visor ? p.eye : OUTLINE} strokeWidth={2.2} strokeLinecap=\"round\" fill=\"none\" />;\n if (mood === \"empty\" && g.eyes.white > 0)\n return (\n <g key={i}>\n <circle cx={at[0]} cy={at[1]} r={g.eyes.white} fill={LIGHT} {...line} />\n <circle cx={at[0]} cy={at[1] + g.eyes.pupil * 0.7} r={g.eyes.pupil} fill={SHADE} />\n <path d={upperLid(at, g.eyes.white)} fill={p.detail} {...line} />\n </g>\n );\n if (mood === \"empty\") return <path key={i} d={lidEye(at, eyeR * 0.8)} stroke={g.visor ? p.eye : OUTLINE} strokeWidth={2.2} strokeLinecap=\"round\" fill=\"none\" />;\n return (\n <g key={i} className=\"kzb-eye kzb-blink\">\n {g.eyes.white > 0 && <circle cx={at[0]} cy={at[1]} r={g.eyes.white} fill={LIGHT} {...line} />}\n <g className=\"kzb-pupil\">\n <circle cx={at[0] + glance} cy={at[1] - glance} r={g.eyes.pupil} fill={g.visor ? p.eye : SHADE} />\n {g.eyes.white > 0 && <circle cx={at[0] + glance - g.eyes.pupil * 0.35} cy={at[1] - glance - g.eyes.pupil * 0.35} r={g.eyes.pupil * 0.35} fill={LIGHT} />}\n </g>\n </g>\n );\n });\n const [wl, wr] = g.wings;\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 120 120\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n data-bird={bird}\n data-mood={mood}\n data-animated={animated ? \"\" : undefined}\n data-life={alive ? \"\" : undefined}\n data-look={alive && look && look !== \"center\" ? look : undefined}\n data-flying={alive && flying ? \"\" : undefined}\n data-poked={alive && poked ? \"\" : undefined}\n className={className}\n style={alive ? ({ \"--kzb-ph\": ph, \"--kzb-bank\": bank ?? 0, ...style } as React.CSSProperties) : style}\n {...(title ? { role: \"img\", \"aria-label\": title } : { \"aria-hidden\": true })}\n {...props}\n >\n <style>{CSS}</style>\n <defs>\n <linearGradient id={`kzb-${uid}`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" style={{ stopColor: p.from }} />\n <stop offset=\"100%\" style={{ stopColor: p.to }} />\n </linearGradient>\n </defs>\n <ellipse cx={g.shadow[0]} cy={g.shadow[1]} rx={g.shadow[2]} ry={g.shadow[3]} fill={SHADE} opacity={0.14} />\n {mood === \"empty\" && <path d={MOOD_PARTS.tray} stroke={OUTLINE} strokeWidth={1.6} strokeDasharray=\"3 3\" strokeLinejoin=\"round\" />}\n <g className=\"kzb-hop\">\n <g className=\"kzb-bird\">\n {g.legs.map((d) => (\n <path key={d} d={d} stroke={p.beak} strokeWidth={2.6} strokeLinecap=\"round\" />\n ))}\n {g.back?.map((d) => (d.endsWith(\"Z\") ? <path key={d} d={d} fill={p.detail} {...line} /> : <path key={d} d={d} stroke={OUTLINE} strokeWidth={1.4} />))}\n {g.parcel && carrying && (\n <g className=\"kzb-parcel\" {...line}>\n {g.parcel.map((d, i) => (\n <path key={d} d={d} fill={PARCEL[i]} />\n ))}\n </g>\n )}\n <path d={g.body} fill={body} {...line} />\n <path d={g.belly} fill={LIGHT} opacity={0.28} />\n {[wl, wr].map((w, i) => {\n let turn = 0;\n if (mood === \"success\") turn = i === 0 ? 28 : -28;\n else if (mood === \"welcome\" && i === 1 && !alive) turn = -20;\n return (\n <g key={i === 1 ? \"right\" : \"left\"} className={i === 1 ? \"kzb-wing kzb-wing-r\" : \"kzb-wing kzb-wing-l\"} style={{ transformOrigin: `${w.pivot[0]}px ${w.pivot[1]}px`, transform: turn ? `rotate(${turn}deg)` : undefined }}>\n <path d={w.d} fill={p.wing} {...line} />\n <path d={w.d} fill={SHADE} opacity={0.16} />\n </g>\n );\n })}\n <g className=\"kzb-look\">\n <g className=\"kzb-head\">\n {g.neck && <path d={g.neck.d} stroke={body} strokeWidth={g.neck.width} strokeLinecap=\"round\" />}\n {g.head.r > 0 && <circle cx={g.head.cx} cy={g.head.cy} r={g.head.r} fill={body} {...line} />}\n {g.details.map((d) => (\n <path key={d} d={d} fill={p.detail} {...line} />\n ))}\n {g.visor && <rect x={g.visor.x} y={g.visor.y} width={g.visor.w} height={g.visor.h} rx={4} fill={SURFACE} {...line} />}\n {eyes}\n {g.glasses && (\n <g stroke={OUTLINE} strokeWidth={1.3}>\n {g.eyes.at.map(([x, y]) => (\n <circle key={x} cx={x} cy={y} r={6.5} fill={LIGHT} fillOpacity={0.12} />\n ))}\n <path d={`M${g.eyes.at[0][0] + 6.5} ${g.eyes.at[0][1]} L${g.eyes.at[1][0] - 6.5} ${g.eyes.at[1][1]}`} />\n </g>\n )}\n {mood === \"error\" &&\n g.eyes.at.map((at, i) => <path key={i} d={brow(at, eyeR, g.eyes.at.length === 1 ? 1 : i === 0 ? -1 : 1)} stroke={OUTLINE} strokeWidth={2} strokeLinecap=\"round\" />)}\n <path d={g.beak} fill={p.beak} {...line} />\n </g>\n </g>\n </g>\n </g>\n {mood === \"thinking\" && (\n <g>\n {MOOD_PARTS.dots.map(([cx, cy, r]) => (\n <circle key={cx} className=\"kzb-dot\" cx={cx} cy={cy} r={r} fill=\"var(--kz-text-secondary)\" />\n ))}\n </g>\n )}\n {mood === \"success\" && (\n <>\n {MOOD_PARTS.sparkles.map((d) => (\n <path key={d} className=\"kzb-sparkle\" d={d} fill={p.from} />\n ))}\n <g className=\"kzb-badge\">\n <circle cx={MOOD_PARTS.badge.cx} cy={MOOD_PARTS.badge.cy} r={MOOD_PARTS.badge.r} fill=\"var(--kz-success)\" />\n <path d={MOOD_PARTS.check} stroke={SURFACE} strokeWidth={2.6} strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </g>\n </>\n )}\n {mood === \"error\" && (\n <g className=\"kzb-badge\">\n <circle cx={MOOD_PARTS.badge.cx} cy={MOOD_PARTS.badge.cy} r={MOOD_PARTS.badge.r} fill=\"var(--kz-danger)\" />\n <path d={MOOD_PARTS.bang.line} stroke={SURFACE} strokeWidth={2.8} strokeLinecap=\"round\" />\n <circle cx={MOOD_PARTS.bang.dot[0]} cy={MOOD_PARTS.bang.dot[1]} r={1.6} fill={SURFACE} />\n </g>\n )}\n </svg>\n );\n}\n"
|
|
422
422
|
},
|
|
423
423
|
{
|
|
424
424
|
"path": "mascots/meta.ts",
|
|
@@ -430,7 +430,7 @@
|
|
|
430
430
|
},
|
|
431
431
|
{
|
|
432
432
|
"path": "mascots/phoenix.tsx",
|
|
433
|
-
"content": "// The phoenix of the Krizaka landscape, on its own: two wings — two rival flames — around one bright core. The sixth\n// figure of the flock: it does no job, it stands for the comeback (a relaunch, a recovered account, a second chance).\nimport type * as React from \"react\";\nimport { useId } from \"react\";\n\nimport { PHOENIX, PHOENIX_PALETTES,type PhoenixPalette } from \"./phoenix-geometry\";\n\nconst CSS = `\n@keyframes kzp-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }\n@keyframes kzp-core { 0%, 100% { opacity: .8; } 50% { opacity: 1; } }\n.kzp[data-animated] { animation: kzp-float 5s ease-in-out infinite; }\n.kzp[data-animated] .kzp-core { animation: kzp-core 2.8s ease-in-out infinite; }\n@media (prefers-reduced-motion: reduce) { .kzp, .kzp .kzp-core { animation: none !important; } }\n`;\n\nexport type PhoenixProps = Omit<React.ComponentProps<\"svg\">, \"children\"> & {\n /** `own` (default): the violet wing and the gold wing of the Krizaka story. `brand`: the host's accent and accent-2. */\n tone?: \"own\" | \"brand\";\n /** Width and height in pixels. */\n size?: number;\n /** A slow float and a breathing core. Off with `false`; always off under `prefers-reduced-motion`. */\n animated?: boolean;\n /** An accessible name (the phoenix becomes an image); without it, it is decorative. */\n title?: string;\n};\n\nconst BRAND: PhoenixPalette = {\n left: [\"var(--kz-accent-2, var(--kz-accent))\", \"var(--kz-accent)\"],\n right: [\"var(--kz-accent)\", \"var(--kz-accent-2, var(--kz-accent))\"],\n core: [\"#ffffff\", \"var(--kz-accent)\"],\n body: \"var(--kz-surface-3)\",\n edge: \"var(--kz-border-strong)\",\n crest: \"var(--kz-accent)\",\n};\n\n/** The phoenix: the comeback, beside the five birds of the flock (`Mascot`). Decorative unless titled. */\nexport function Phoenix({ tone = \"own\", size = 120, animated = true, title, className, ...props }: PhoenixProps) {\n const id = useId().
|
|
433
|
+
"content": "// The phoenix of the Krizaka landscape, on its own: two wings — two rival flames — around one bright core. The sixth\n// figure of the flock: it does no job, it stands for the comeback (a relaunch, a recovered account, a second chance).\nimport type * as React from \"react\";\nimport { useId } from \"react\";\n\nimport { PHOENIX, PHOENIX_PALETTES,type PhoenixPalette } from \"./phoenix-geometry\";\n\nconst CSS = `\n@keyframes kzp-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }\n@keyframes kzp-core { 0%, 100% { opacity: .8; } 50% { opacity: 1; } }\n.kzp[data-animated] { animation: kzp-float 5s ease-in-out infinite; }\n.kzp[data-animated] .kzp-core { animation: kzp-core 2.8s ease-in-out infinite; }\n@media (prefers-reduced-motion: reduce) { .kzp, .kzp .kzp-core { animation: none !important; } }\n`;\n\nexport type PhoenixProps = Omit<React.ComponentProps<\"svg\">, \"children\"> & {\n /** `own` (default): the violet wing and the gold wing of the Krizaka story. `brand`: the host's accent and accent-2. */\n tone?: \"own\" | \"brand\";\n /** Width and height in pixels. */\n size?: number;\n /** A slow float and a breathing core. Off with `false`; always off under `prefers-reduced-motion`. */\n animated?: boolean;\n /** An accessible name (the phoenix becomes an image); without it, it is decorative. */\n title?: string;\n};\n\nconst BRAND: PhoenixPalette = {\n left: [\"var(--kz-accent-2, var(--kz-accent))\", \"var(--kz-accent)\"],\n right: [\"var(--kz-accent)\", \"var(--kz-accent-2, var(--kz-accent))\"],\n core: [\"#ffffff\", \"var(--kz-accent)\"],\n body: \"var(--kz-surface-3)\",\n edge: \"var(--kz-border-strong)\",\n crest: \"var(--kz-accent)\",\n};\n\n/** The phoenix: the comeback, beside the five birds of the flock (`Mascot`). Decorative unless titled. */\nexport function Phoenix({ tone = \"own\", size = 120, animated = true, title, className, ...props }: Readonly<PhoenixProps>) {\n const id = useId().replaceAll(/[^a-zA-Z0-9_-]/g, \"\");\n const p = tone === \"brand\" ? BRAND : PHOENIX_PALETTES.own;\n const a11y = title ? { role: \"img\", \"aria-label\": title } : { \"aria-hidden\": true };\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 120 120\"\n fill=\"none\"\n data-animated={animated ? \"\" : undefined}\n className={[\"kzp\", className].filter(Boolean).join(\" \")}\n {...a11y}\n {...props}\n >\n <style>{CSS}</style>\n <defs>\n <linearGradient id={`kzp-l-${id}`} x1=\"1\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor={p.left[0]} />\n <stop offset=\"100%\" stopColor={p.left[1]} />\n </linearGradient>\n <linearGradient id={`kzp-r-${id}`} x1=\"0\" y1=\"0\" x2=\"1\" y2=\"1\">\n <stop offset=\"0%\" stopColor={p.right[0]} />\n <stop offset=\"100%\" stopColor={p.right[1]} />\n </linearGradient>\n <radialGradient id={`kzp-c-${id}`}>\n <stop offset=\"0%\" stopColor={p.core[0]} />\n <stop offset=\"100%\" stopColor={p.core[1]} stopOpacity=\"0\" />\n </radialGradient>\n </defs>\n <path d={PHOENIX.wingL} fill={`url(#kzp-l-${id})`} />\n <path d={PHOENIX.wingR} fill={`url(#kzp-r-${id})`} />\n <path d={PHOENIX.tailL} fill={`url(#kzp-l-${id})`} opacity=\".7\" />\n <path d={PHOENIX.tailR} fill={`url(#kzp-r-${id})`} opacity=\".7\" />\n <path d={PHOENIX.body} fill={p.body} stroke={p.edge} strokeOpacity=\".5\" />\n <circle cx=\"60\" cy=\"58\" r=\"12\" fill={`url(#kzp-c-${id})`} className=\"kzp-core\" />\n <circle cx=\"60\" cy=\"58\" r=\"3.5\" fill=\"#fff\" />\n <path d={PHOENIX.crest} stroke={p.crest} strokeWidth=\"2\" strokeLinecap=\"round\" />\n </svg>\n );\n}\n"
|
|
434
434
|
},
|
|
435
435
|
{
|
|
436
436
|
"path": "meta.ts",
|
|
@@ -242,7 +242,7 @@
|
|
|
242
242
|
},
|
|
243
243
|
{
|
|
244
244
|
"path": "match-dialog/match-dialog.tsx",
|
|
245
|
-
"content": "// Client (a portal). The moment two people choose each other — a match, a pair, a deal: a dialog in the brand\n// gradient, the two avatars meeting at a heart, the next step. The entrance plays once; still under reduced motion.\nimport * as React from \"react\";\n\nimport { Avatar } from \"../avatar\";\nimport { Button } from \"../button\";\nimport { warnDeprecated } from \"../deprecated\";\nimport { Dialog } from \"../dialog\";\n\nexport type MatchDialogProps = {\n /** Shown (controlled). */\n open: boolean;\n /** Called when it closes. */\n onOpenChange: (open: boolean) => void;\n /** The headline (“It's a match!”) — passed translated; the dialog's name. */\n title: string;\n /** A line under it. */\n description?: string;\n /** The two people: avatar URLs and names. */\n people: readonly [{ src?: string | null; name: string }, { src?: string | null; name: string }];\n /** The main action (“Send a message”). */\n primaryLabel: string;\n /** What it does. */\n onPrimary: () => void;\n /** The way back (“Keep swiping”). */\n secondaryLabel: string;\n /** Where it is drawn (the page's body by default): give an element inside a brand scope (`.brand-…`) so the dialog wears the brand too. */\n container?: HTMLElement | null;\n};\n\n/**\n * Two people choose each other: the avatars meet at a heart in the brand gradient, the next step under them.\n * @deprecated Since 3.55 (ADR-006, krizaka-ui#674): no product uses it. Removed in 4.0.\n */\nexport function MatchDialog({ open, onOpenChange, title, description, people, primaryLabel, onPrimary, secondaryLabel, container }: MatchDialogProps) {\n warnDeprecated(\"match-dialog\");\n return (\n <Dialog.Root open={open} onOpenChange={onOpenChange}>\n <Dialog.Content hideClose size=\"sm\" container={container} className=\"overflow-hidden border-0 bg-gradient-to-br from-accent to-accent-2 text-center text-on-accent\">\n <style href=\"krizaka-match\" precedence=\"default\">\n {\"@media (prefers-reduced-motion:no-preference){[data-kz-match] [data-side=a]{animation:kz-match-a .55s cubic-bezier(.3,1.6,.5,1) both}[data-kz-match] [data-side=b]{animation:kz-match-b .55s cubic-bezier(.3,1.6,.5,1) both}[data-kz-match] [data-heart]{animation:kz-match-heart .45s .25s cubic-bezier(.3,1.6,.5,1) both}}@keyframes kz-match-a{from{transform:translateX(-60px) rotate(-8deg);opacity:0}}@keyframes kz-match-b{from{transform:translateX(60px) rotate(8deg);opacity:0}}@keyframes kz-match-heart{from{transform:scale(0)}}\"}\n </style>\n <div data-kz-match=\"\" className=\"flex flex-col items-center gap-3 px-2 pb-2 pt-6\">\n <Dialog.Title className=\"font-display text-4xl font-black text-on-accent\">{title}</Dialog.Title>\n {description ? <Dialog.Description className=\"max-w-xs text-sm text-on-accent\">{description}</Dialog.Description> : null}\n <div className=\"relative my-6 flex h-36 w-64 items-center justify-center\" aria-hidden>\n <span data-side=\"a\" className=\"absolute left-6 -rotate-6 rounded-full ring-4 ring-on-accent\">\n <Avatar src={people[0].src ?? null} alt=\"\" fallback={people[0].name.charAt(0)} className=\"h-28 w-28 text-3xl\" />\n </span>\n <span data-side=\"b\" className=\"absolute right-6 rotate-6 rounded-full ring-4 ring-on-accent\">\n <Avatar src={people[1].src ?? null} alt=\"\" fallback={people[1].name.charAt(0)} className=\"h-28 w-28 text-3xl\" />\n </span>\n <span data-heart=\"\" className=\"absolute -bottom-1 flex h-12 w-12 items-center justify-center rounded-full bg-on-accent text-accent shadow-lg\">\n <svg viewBox=\"0 0 24 24\" className=\"h-6 w-6\" fill=\"currentColor\">\n <path d=\"M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z\" />\n </svg>\n </span>\n </div>\n <div className=\"flex w-full flex-col gap-2\">\n <Button\n size=\"lg\"\n onClick={() => {\n onOpenChange(false);\n onPrimary();\n }}\n >\n {primaryLabel}\n </Button>\n <Dialog.Close asChild>\n <Button size=\"lg\" variant=\"ghost\" className=\"text-on-accent hover:bg-on-accent/15\">\n {secondaryLabel}\n </Button>\n </Dialog.Close>\n </div>\n </div>\n </Dialog.Content>\n </Dialog.Root>\n );\n}\n"
|
|
245
|
+
"content": "// Client (a portal). The moment two people choose each other — a match, a pair, a deal: a dialog in the brand\n// gradient, the two avatars meeting at a heart, the next step. The entrance plays once; still under reduced motion.\nimport * as React from \"react\";\n\nimport { Avatar } from \"../avatar\";\nimport { Button } from \"../button\";\nimport { warnDeprecated } from \"../deprecated\";\nimport { Dialog } from \"../dialog\";\n\nexport type MatchDialogProps = {\n /** Shown (controlled). */\n open: boolean;\n /** Called when it closes. */\n onOpenChange: (open: boolean) => void;\n /** The headline (“It's a match!”) — passed translated; the dialog's name. */\n title: string;\n /** A line under it. */\n description?: string;\n /** The two people: avatar URLs and names. */\n people: readonly [{ src?: string | null; name: string }, { src?: string | null; name: string }];\n /** The main action (“Send a message”). */\n primaryLabel: string;\n /** What it does. */\n onPrimary: () => void;\n /** The way back (“Keep swiping”). */\n secondaryLabel: string;\n /** Where it is drawn (the page's body by default): give an element inside a brand scope (`.brand-…`) so the dialog wears the brand too. */\n container?: HTMLElement | null;\n};\n\n/**\n * Two people choose each other: the avatars meet at a heart in the brand gradient, the next step under them.\n * @deprecated Since 3.55 (ADR-006, krizaka-ui#674): no product uses it. Removed in 4.0.\n */\nexport function MatchDialog({ open, onOpenChange, title, description, people, primaryLabel, onPrimary, secondaryLabel, container }: Readonly<MatchDialogProps>) {\n warnDeprecated(\"match-dialog\");\n return (\n <Dialog.Root open={open} onOpenChange={onOpenChange}>\n <Dialog.Content hideClose size=\"sm\" container={container} className=\"overflow-hidden border-0 bg-gradient-to-br from-accent to-accent-2 text-center text-on-accent\">\n <style href=\"krizaka-match\" precedence=\"default\">\n {\"@media (prefers-reduced-motion:no-preference){[data-kz-match] [data-side=a]{animation:kz-match-a .55s cubic-bezier(.3,1.6,.5,1) both}[data-kz-match] [data-side=b]{animation:kz-match-b .55s cubic-bezier(.3,1.6,.5,1) both}[data-kz-match] [data-heart]{animation:kz-match-heart .45s .25s cubic-bezier(.3,1.6,.5,1) both}}@keyframes kz-match-a{from{transform:translateX(-60px) rotate(-8deg);opacity:0}}@keyframes kz-match-b{from{transform:translateX(60px) rotate(8deg);opacity:0}}@keyframes kz-match-heart{from{transform:scale(0)}}\"}\n </style>\n <div data-kz-match=\"\" className=\"flex flex-col items-center gap-3 px-2 pb-2 pt-6\">\n <Dialog.Title className=\"font-display text-4xl font-black text-on-accent\">{title}</Dialog.Title>\n {description ? <Dialog.Description className=\"max-w-xs text-sm text-on-accent\">{description}</Dialog.Description> : null}\n <div className=\"relative my-6 flex h-36 w-64 items-center justify-center\" aria-hidden>\n <span data-side=\"a\" className=\"absolute left-6 -rotate-6 rounded-full ring-4 ring-on-accent\">\n <Avatar src={people[0].src ?? null} alt=\"\" fallback={people[0].name.charAt(0)} className=\"h-28 w-28 text-3xl\" />\n </span>\n <span data-side=\"b\" className=\"absolute right-6 rotate-6 rounded-full ring-4 ring-on-accent\">\n <Avatar src={people[1].src ?? null} alt=\"\" fallback={people[1].name.charAt(0)} className=\"h-28 w-28 text-3xl\" />\n </span>\n <span data-heart=\"\" className=\"absolute -bottom-1 flex h-12 w-12 items-center justify-center rounded-full bg-on-accent text-accent shadow-lg\">\n <svg viewBox=\"0 0 24 24\" className=\"h-6 w-6\" fill=\"currentColor\">\n <path d=\"M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z\" />\n </svg>\n </span>\n </div>\n <div className=\"flex w-full flex-col gap-2\">\n <Button\n size=\"lg\"\n onClick={() => {\n onOpenChange(false);\n onPrimary();\n }}\n >\n {primaryLabel}\n </Button>\n <Dialog.Close asChild>\n <Button size=\"lg\" variant=\"ghost\" className=\"text-on-accent hover:bg-on-accent/15\">\n {secondaryLabel}\n </Button>\n </Dialog.Close>\n </div>\n </div>\n </Dialog.Content>\n </Dialog.Root>\n );\n}\n"
|
|
246
246
|
},
|
|
247
247
|
{
|
|
248
248
|
"path": "match-dialog/meta.ts",
|
|
@@ -258,7 +258,7 @@
|
|
|
258
258
|
},
|
|
259
259
|
{
|
|
260
260
|
"path": "glyphs.tsx",
|
|
261
|
-
"content": "// The small line glyphs the data and media primitives draw (play, volume, search, chevrons…): decorative, 24-unit\n// box, `currentColor`, sized by the caller's class. Shared by the entries that need them; never exported on its own —\n// a product draws its own icons with @krizaka/icons.\nimport type * as React from \"react\";\n\ntype GlyphProps = { className?: string };\n\nfunction Glyph({ className = \"h-4 w-4\", fill, children }: GlyphProps & { fill?: boolean; children: React.ReactNode }) {\n return (\n <svg\n viewBox=\"0 0 24 24\"\n className={className}\n fill={fill ? \"currentColor\" : \"none\"}\n stroke={fill ? \"none\" : \"currentColor\"}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden\n focusable=\"false\"\n >\n {children}\n </svg>\n );\n}\n\nexport const PlayGlyph = (p: GlyphProps) => (\n <Glyph {...p} fill>\n <path d=\"M8 5.5v13a1 1 0 0 0 1.5.86l10.4-6.5a1 1 0 0 0 0-1.72L9.5 4.64A1 1 0 0 0 8 5.5Z\" />\n </Glyph>\n);\nexport const PauseGlyph = (p: GlyphProps) => (\n <Glyph {...p} fill>\n <rect x=\"6\" y=\"5\" width=\"4\" height=\"14\" rx=\"1\" />\n <rect x=\"14\" y=\"5\" width=\"4\" height=\"14\" rx=\"1\" />\n </Glyph>\n);\nexport const VolumeGlyph = ({ muted, ...p }: GlyphProps & { muted?: boolean }) => (\n <Glyph {...p}>\n <path d=\"M11 5 6 9H3v6h3l5 4V5Z\" />\n {muted ? <path d=\"m22 9-6 6m0-6 6 6\" /> : <path d=\"M15.5 8.5a5 5 0 0 1 0 7M18.5 5.5a9 9 0 0 1 0 13\" />}\n </Glyph>\n);\nexport const FullscreenGlyph = ({ exit, ...p }: GlyphProps & { exit?: boolean }) => (\n <Glyph {...p}>\n {exit ? <path d=\"M9 4v5H4m11-5v5h5M9 20v-5H4m11 5v-5h5\" /> : <path d=\"M4 9V4h5m6 0h5v5M4 15v5h5m11-5v5h-5\" />}\n </Glyph>\n);\nexport const CaptionsGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\" />\n <path d=\"M10 10.5a2 2 0 1 0 0 3M17 10.5a2 2 0 1 0 0 3\" />\n </Glyph>\n);\nexport const PipGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\" />\n <rect x=\"12\" y=\"12\" width=\"6\" height=\"4\" rx=\"1\" />\n </Glyph>\n);\nexport const SearchGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <circle cx=\"11\" cy=\"11\" r=\"7\" />\n <path d=\"m20 20-3.5-3.5\" />\n </Glyph>\n);\nexport const CloseGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M18 6 6 18M6 6l12 12\" />\n </Glyph>\n);\nexport const ChevronGlyph = ({ direction = \"down\", ...p }: GlyphProps & { direction?: \"left\" | \"right\" | \"up\" | \"down\" }) => (\n <Glyph {...p}>\n <path d={{ left: \"m15 6-6 6 6 6\", right: \"m9 6 6 6-6 6\", up: \"m6 15 6-6 6 6\", down: \"m6 9 6 6 6-6\" }[direction]} />\n </Glyph>\n);\nexport const CheckGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M20 6 9 17l-5-5\" />\n </Glyph>\n);\nexport const PlusGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M12 5v14M5 12h14\" />\n </Glyph>\n);\nexport const CalendarGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <rect x=\"3\" y=\"5\" width=\"18\" height=\"16\" rx=\"2\" />\n <path d=\"M3 10h18M8 3v4M16 3v4\" />\n </Glyph>\n);\nexport const UploadGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M12 16V4m0 0L7 9m5-5 5 5\" />\n <path d=\"M4 16v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2\" />\n </Glyph>\n);\nexport const FileGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8l-5-5Z\" />\n <path d=\"M14 3v5h5\" />\n </Glyph>\n);\nexport const CameraGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M4 8h3l2-3h6l2 3h3a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1Z\" />\n <circle cx=\"12\" cy=\"13.5\" r=\"3.5\" />\n </Glyph>\n);\nexport const FlipGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M4 12a8 8 0 0 1 14-5.3M20 12a8 8 0 0 1-14 5.3\" />\n <path d=\"M18 3v4h-4M6 21v-4h4\" />\n </Glyph>\n);\nexport const RetryGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M4 12a8 8 0 1 0 2.3-5.7L4 8.5\" />\n <path d=\"M4 4v4.5h4.5\" />\n </Glyph>\n);\nexport const SortGlyph = ({ direction, ...p }: GlyphProps & { direction?: \"ascending\" | \"descending\" }) => (\n <Glyph {...p}>\n {direction === \"ascending\" ? <path d=\"m7 14 5-5 5 5\" /> : direction === \"descending\" ? <path d=\"m7 10 5 5 5-5\" /> : <path d=\"m8 9 4-4 4 4M8 15l4 4 4-4\" />}\n </Glyph>\n);\nexport const ArrowGlyph = ({ direction = \"right\", ...p }: GlyphProps & { direction?: \"left\" | \"right\" }) => (\n <Glyph {...p}>\n <path d={direction === \"left\" ? \"M19 12H5m0 0 6-6m-6 6 6 6\" : \"M5 12h14m0 0-6-6m6 6-6 6\"} />\n </Glyph>\n);\nexport const ExternalGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M14 4h6v6M20 4l-9 9\" />\n <path d=\"M18 14v4a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4\" />\n </Glyph>\n);\nexport const WarningGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M12 4 2.5 20h19L12 4Z\" />\n <path d=\"M12 10v4M12 17.2v.1\" />\n </Glyph>\n);\nexport const CopyGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <rect x=\"9\" y=\"9\" width=\"11\" height=\"11\" rx=\"2\" />\n <path d=\"M15 9V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h3\" />\n </Glyph>\n);\nexport const PencilGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M4 20h4L19 9a2.8 2.8 0 0 0-4-4L4 16v4zM13.5 6.5l4 4\" />\n </Glyph>\n);\n"
|
|
261
|
+
"content": "// The small line glyphs the data and media primitives draw (play, volume, search, chevrons…): decorative, 24-unit\n// box, `currentColor`, sized by the caller's class. Shared by the entries that need them; never exported on its own —\n// a product draws its own icons with @krizaka/icons.\nimport type * as React from \"react\";\n\ntype GlyphProps = { className?: string };\n\nfunction Glyph({ className = \"h-4 w-4\", fill, children }: Readonly<GlyphProps & { fill?: boolean; children: React.ReactNode }>) {\n return (\n <svg\n viewBox=\"0 0 24 24\"\n className={className}\n fill={fill ? \"currentColor\" : \"none\"}\n stroke={fill ? \"none\" : \"currentColor\"}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden\n focusable=\"false\"\n >\n {children}\n </svg>\n );\n}\n\nexport const PlayGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p} fill>\n <path d=\"M8 5.5v13a1 1 0 0 0 1.5.86l10.4-6.5a1 1 0 0 0 0-1.72L9.5 4.64A1 1 0 0 0 8 5.5Z\" />\n </Glyph>\n);\nexport const PauseGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p} fill>\n <rect x=\"6\" y=\"5\" width=\"4\" height=\"14\" rx=\"1\" />\n <rect x=\"14\" y=\"5\" width=\"4\" height=\"14\" rx=\"1\" />\n </Glyph>\n);\nexport const VolumeGlyph = ({ muted, ...p }: Readonly<GlyphProps & { muted?: boolean }>) => (\n <Glyph {...p}>\n <path d=\"M11 5 6 9H3v6h3l5 4V5Z\" />\n {muted ? <path d=\"m22 9-6 6m0-6 6 6\" /> : <path d=\"M15.5 8.5a5 5 0 0 1 0 7M18.5 5.5a9 9 0 0 1 0 13\" />}\n </Glyph>\n);\nexport const FullscreenGlyph = ({ exit, ...p }: Readonly<GlyphProps & { exit?: boolean }>) => (\n <Glyph {...p}>\n {exit ? <path d=\"M9 4v5H4m11-5v5h5M9 20v-5H4m11 5v-5h5\" /> : <path d=\"M4 9V4h5m6 0h5v5M4 15v5h5m11-5v5h-5\" />}\n </Glyph>\n);\nexport const CaptionsGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p}>\n <rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\" />\n <path d=\"M10 10.5a2 2 0 1 0 0 3M17 10.5a2 2 0 1 0 0 3\" />\n </Glyph>\n);\nexport const PipGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p}>\n <rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\" />\n <rect x=\"12\" y=\"12\" width=\"6\" height=\"4\" rx=\"1\" />\n </Glyph>\n);\nexport const SearchGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p}>\n <circle cx=\"11\" cy=\"11\" r=\"7\" />\n <path d=\"m20 20-3.5-3.5\" />\n </Glyph>\n);\nexport const CloseGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p}>\n <path d=\"M18 6 6 18M6 6l12 12\" />\n </Glyph>\n);\nexport const ChevronGlyph = ({ direction = \"down\", ...p }: Readonly<GlyphProps & { direction?: \"left\" | \"right\" | \"up\" | \"down\" }>) => (\n <Glyph {...p}>\n <path d={{ left: \"m15 6-6 6 6 6\", right: \"m9 6 6 6-6 6\", up: \"m6 15 6-6 6 6\", down: \"m6 9 6 6 6-6\" }[direction]} />\n </Glyph>\n);\nexport const CheckGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p}>\n <path d=\"M20 6 9 17l-5-5\" />\n </Glyph>\n);\nexport const PlusGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p}>\n <path d=\"M12 5v14M5 12h14\" />\n </Glyph>\n);\nexport const CalendarGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p}>\n <rect x=\"3\" y=\"5\" width=\"18\" height=\"16\" rx=\"2\" />\n <path d=\"M3 10h18M8 3v4M16 3v4\" />\n </Glyph>\n);\nexport const UploadGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p}>\n <path d=\"M12 16V4m0 0L7 9m5-5 5 5\" />\n <path d=\"M4 16v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2\" />\n </Glyph>\n);\nexport const FileGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p}>\n <path d=\"M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8l-5-5Z\" />\n <path d=\"M14 3v5h5\" />\n </Glyph>\n);\nexport const CameraGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p}>\n <path d=\"M4 8h3l2-3h6l2 3h3a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1Z\" />\n <circle cx=\"12\" cy=\"13.5\" r=\"3.5\" />\n </Glyph>\n);\nexport const FlipGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p}>\n <path d=\"M4 12a8 8 0 0 1 14-5.3M20 12a8 8 0 0 1-14 5.3\" />\n <path d=\"M18 3v4h-4M6 21v-4h4\" />\n </Glyph>\n);\nexport const RetryGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p}>\n <path d=\"M4 12a8 8 0 1 0 2.3-5.7L4 8.5\" />\n <path d=\"M4 4v4.5h4.5\" />\n </Glyph>\n);\nexport const SortGlyph = ({ direction, ...p }: Readonly<GlyphProps & { direction?: \"ascending\" | \"descending\" }>) => (\n <Glyph {...p}>\n {direction === \"ascending\" ? <path d=\"m7 14 5-5 5 5\" /> : direction === \"descending\" ? <path d=\"m7 10 5 5 5-5\" /> : <path d=\"m8 9 4-4 4 4M8 15l4 4 4-4\" />}\n </Glyph>\n);\nexport const ArrowGlyph = ({ direction = \"right\", ...p }: Readonly<GlyphProps & { direction?: \"left\" | \"right\" }>) => (\n <Glyph {...p}>\n <path d={direction === \"left\" ? \"M19 12H5m0 0 6-6m-6 6 6 6\" : \"M5 12h14m0 0-6-6m6 6-6 6\"} />\n </Glyph>\n);\nexport const ExternalGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p}>\n <path d=\"M14 4h6v6M20 4l-9 9\" />\n <path d=\"M18 14v4a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4\" />\n </Glyph>\n);\nexport const WarningGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p}>\n <path d=\"M12 4 2.5 20h19L12 4Z\" />\n <path d=\"M12 10v4M12 17.2v.1\" />\n </Glyph>\n);\nexport const CopyGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p}>\n <rect x=\"9\" y=\"9\" width=\"11\" height=\"11\" rx=\"2\" />\n <path d=\"M15 9V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h3\" />\n </Glyph>\n);\nexport const PencilGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p}>\n <path d=\"M4 20h4L19 9a2.8 2.8 0 0 0-4-4L4 16v4zM13.5 6.5l4 4\" />\n </Glyph>\n);\n"
|
|
262
262
|
},
|
|
263
263
|
{
|
|
264
264
|
"path": "media-capture/index.ts",
|
|
@@ -266,7 +266,7 @@
|
|
|
266
266
|
},
|
|
267
267
|
{
|
|
268
268
|
"path": "media-capture/media-capture.tsx",
|
|
269
|
-
"content": "// Client. The camera in the page: asks for it only when the person presses the button (never on load), shows the\n// preview (mirrored for the front camera), takes a photo (a canvas → JPEG `Blob`) or records a clip (MediaRecorder,\n// a timer, a maximum length), switches cameras. Every dead end has a way out: permission refused, no camera, no\n// `getUserMedia` (an old browser, an insecure page) → the file picker with `capture`, which opens the phone's own\n// camera. The tracks stop when it unmounts or the page is hidden.\nimport * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { warnDeprecated } from \"../deprecated\";\nimport { CameraGlyph, FlipGlyph } from \"../glyphs\";\nimport { formatClock, playSafely, usePrefersReducedMotion } from \"../media\";\n\n/** @deprecated Since 3.55 (ADR-006, krizaka-ui#674): no product uses it. Removed in 4.0. */\nexport const mediaCapture = tv({\n slots: {\n root: \"theme-dark relative isolate flex w-full flex-col overflow-hidden rounded-xl bg-media text-fg-on-media\",\n stage: \"relative w-full\",\n video: \"absolute inset-0 h-full w-full object-cover data-[mirrored]:-scale-x-100\",\n panel: \"absolute inset-0 flex flex-col items-center justify-center gap-3 p-6 text-center text-sm\",\n panelIcon: \"flex h-12 w-12 items-center justify-center rounded-full bg-fg-on-media/15\",\n primary:\n \"inline-flex h-10 items-center justify-center gap-2 rounded-lg bg-accent px-4 text-sm font-semibold text-on-accent hover:bg-accent-hover \" +\n \"focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-media\",\n secondary:\n \"inline-flex h-10 items-center justify-center gap-2 rounded-lg border border-fg-on-media/40 px-4 text-sm font-semibold text-fg-on-media hover:bg-fg-on-media/10 \" +\n \"focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring\",\n bar: \"absolute inset-x-0 bottom-0 flex items-center justify-center gap-6 bg-linear-to-t from-scrim-strong to-transparent px-4 pb-4 pt-10\",\n shutter:\n \"relative inline-flex h-16 w-16 items-center justify-center rounded-full border-4 border-fg-on-media bg-transparent \" +\n \"focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-media \" +\n \"after:h-12 after:w-12 after:rounded-full after:bg-fg-on-media after:transition-all motion-reduce:after:transition-none \" +\n \"data-[mode=video]:after:bg-danger data-[recording]:after:h-6 data-[recording]:after:w-6 data-[recording]:after:rounded-md\",\n round:\n \"inline-flex h-11 w-11 items-center justify-center rounded-full bg-scrim-strong text-fg-on-media hover:bg-scrim \" +\n \"focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring disabled:invisible\",\n modes: \"absolute inset-x-0 top-3 flex justify-center\",\n mode:\n \"rounded-full px-3 py-1 text-xs font-semibold text-fg-on-media/80 aria-pressed:bg-fg-on-media aria-pressed:text-media \" +\n \"focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring\",\n timer:\n \"absolute left-3 top-3 inline-flex items-center gap-1.5 rounded-full bg-scrim-strong px-2.5 py-1 font-mono text-xs tabular-nums \" +\n \"before:h-2 before:w-2 before:rounded-full before:bg-danger before:animate-pulse motion-reduce:before:animate-none\",\n },\n});\n\nexport type CaptureResult = {\n /** The photo (JPEG) or the clip (WebM / MP4, as the browser records). */\n blob: Blob;\n /** `photo` or `video`. */\n kind: \"photo\" | \"video\";\n /** An object URL of the blob, to preview it (revoke it when done). */\n url: string;\n};\n\nexport type MediaCaptureLabels = {\n /** The accessible name of the camera (\"Camera\"). */\n region: string;\n /** Why the camera is asked for, before the request (\"Use your camera to take a photo\"). */\n prompt: string;\n /** The button that asks (\"Turn on the camera\"). */\n start: string;\n /** Permission refused (\"Camera access is blocked. Allow it in your browser settings, or choose a file.\"). */\n denied: string;\n /** No camera, or no access possible here (\"No camera is available.\"). */\n unavailable: string;\n /** The way out: the file picker (\"Choose a file\"). */\n fallback: string;\n takePhoto: string;\n startRecording: string;\n stopRecording: string;\n switchCamera: string;\n photoMode: string;\n videoMode: string;\n};\n\n/** @deprecated Since 3.55 (ADR-006, krizaka-ui#674): no product uses it. Removed in 4.0. */\nexport const mediaCaptureLabels: MediaCaptureLabels = {\n region: \"Camera\",\n prompt: \"Use your camera to take a photo or record a clip.\",\n start: \"Turn on the camera\",\n denied: \"Camera access is blocked. Allow it in your browser settings, or choose a file.\",\n unavailable: \"No camera is available here.\",\n fallback: \"Choose a file\",\n takePhoto: \"Take photo\",\n startRecording: \"Start recording\",\n stopRecording: \"Stop recording\",\n switchCamera: \"Switch camera\",\n photoMode: \"Photo\",\n videoMode: \"Video\",\n};\n\nexport type MediaCaptureProps = {\n /** What it captures: `photo` (default), `video`, or `both` (a switch above the preview). */\n mode?: \"photo\" | \"video\" | \"both\";\n /** The camera at first: `user` (front, mirrored, default) or `environment` (back). */\n facing?: \"user\" | \"environment\";\n /** Records the microphone with a clip. Default `true`. */\n audio?: boolean;\n /** The longest clip, in seconds: recording stops by itself. */\n maxDuration?: number;\n /** Starts the camera at mount (only when the permission is already granted — never a prompt on load). */\n autoStart?: boolean;\n /** Called with a photo taken or a clip recorded (or a file picked in the fallback). */\n onCapture: (result: CaptureResult) => void;\n /** Called when the camera cannot start (`NotAllowedError`, `NotFoundError`…). */\n onError?: (error: unknown) => void;\n /** The width / height ratio of the preview. Default `\"3 / 4\"`. */\n aspectRatio?: string;\n /** The words, passed translated; English by default. */\n labels?: Partial<MediaCaptureLabels>;\n /** Classes merged on the root. */\n className?: string;\n};\n\ntype State = \"idle\" | \"starting\" | \"live\" | \"denied\" | \"unavailable\";\n\nconst supported = () => typeof navigator !== \"undefined\" && Boolean(navigator.mediaDevices?.getUserMedia);\nconst recorderType = () =>\n typeof MediaRecorder === \"undefined\" ? undefined : [\"video/webm;codecs=vp9,opus\", \"video/webm\", \"video/mp4\"].find((t) => MediaRecorder.isTypeSupported?.(t));\n\n/**\n * The camera in the page: photo or clip, front or back, with a file-picker way out when the camera cannot start.\n * @deprecated Since 3.55 (ADR-006, krizaka-ui#674): no product uses it. Removed in 4.0.\n */\nexport function MediaCapture({\n mode = \"photo\",\n facing: initialFacing = \"user\",\n audio = true,\n maxDuration,\n autoStart,\n onCapture,\n onError,\n aspectRatio = \"3 / 4\",\n labels: given,\n className,\n}: MediaCaptureProps) {\n warnDeprecated(\"media-capture\");\n const labels = { ...mediaCaptureLabels, ...given };\n const s = mediaCapture();\n const reduce = usePrefersReducedMotion();\n const video = React.useRef<HTMLVideoElement>(null);\n const stream = React.useRef<MediaStream | null>(null);\n const recorder = React.useRef<MediaRecorder | null>(null);\n const file = React.useRef<HTMLInputElement>(null);\n const [state, setState] = React.useState<State>(\"idle\");\n const [facing, setFacing] = React.useState(initialFacing);\n const [kind, setKind] = React.useState<\"photo\" | \"video\">(mode === \"video\" ? \"video\" : \"photo\");\n const [recording, setRecording] = React.useState(false);\n const [elapsed, setElapsed] = React.useState(0);\n const [cameras, setCameras] = React.useState(0);\n\n const stop = React.useCallback(() => {\n if (recorder.current?.state === \"recording\") recorder.current.stop();\n stream.current?.getTracks().forEach((track) => track.stop());\n stream.current = null;\n }, []);\n\n const start = React.useCallback(\n async (side: \"user\" | \"environment\") => {\n if (!supported()) {\n setState(\"unavailable\");\n return;\n }\n setState(\"starting\");\n stop();\n try {\n const media = await navigator.mediaDevices.getUserMedia({ video: { facingMode: side }, audio: mode !== \"photo\" && audio });\n stream.current = media;\n if (video.current) {\n video.current.srcObject = media;\n playSafely(video.current);\n }\n const devices = await navigator.mediaDevices.enumerateDevices?.().catch(() => []);\n setCameras((devices ?? []).filter((d) => d.kind === \"videoinput\").length);\n setState(\"live\");\n } catch (error) {\n const name = (error as { name?: string })?.name;\n setState(name === \"NotAllowedError\" || name === \"SecurityError\" ? \"denied\" : \"unavailable\");\n onError?.(error);\n }\n },\n [audio, mode, onError, stop],\n );\n\n React.useEffect(() => {\n if (!autoStart || !supported() || !navigator.permissions?.query) return;\n let live = true;\n navigator.permissions\n .query({ name: \"camera\" as PermissionName })\n .then((status) => {\n if (live && status.state === \"granted\") void start(initialFacing);\n })\n .catch(() => undefined);\n return () => {\n live = false;\n };\n }, [autoStart, initialFacing, start]);\n\n React.useEffect(() => {\n const hide = () => {\n if (!document.hidden) return;\n stop();\n setState((current) => (current === \"live\" ? \"idle\" : current));\n };\n document.addEventListener(\"visibilitychange\", hide);\n return () => {\n document.removeEventListener(\"visibilitychange\", hide);\n stop();\n };\n }, [stop]);\n\n React.useEffect(() => {\n if (!recording) return;\n const began = Date.now();\n const timer = setInterval(() => {\n const seconds = (Date.now() - began) / 1000;\n setElapsed(seconds);\n if (maxDuration && seconds >= maxDuration) recorder.current?.stop();\n }, 250);\n return () => clearInterval(timer);\n }, [recording, maxDuration]);\n\n const deliver = (blob: Blob, captured: \"photo\" | \"video\") => onCapture({ blob, kind: captured, url: URL.createObjectURL(blob) });\n\n const takePhoto = () => {\n const element = video.current;\n if (!element?.videoWidth) return;\n const canvas = document.createElement(\"canvas\");\n canvas.width = element.videoWidth;\n canvas.height = element.videoHeight;\n const context = canvas.getContext(\"2d\");\n if (!context) return;\n if (facing === \"user\") {\n context.translate(canvas.width, 0);\n context.scale(-1, 1);\n }\n context.drawImage(element, 0, 0);\n canvas.toBlob((blob) => blob && deliver(blob, \"photo\"), \"image/jpeg\", 0.92);\n };\n\n const toggleRecording = () => {\n if (recording) {\n recorder.current?.stop();\n return;\n }\n if (!stream.current) return;\n const chunks: Blob[] = [];\n const type = recorderType();\n const next = new MediaRecorder(stream.current, type ? { mimeType: type } : undefined);\n next.ondataavailable = (event) => event.data.size && chunks.push(event.data);\n next.onstop = () => {\n setRecording(false);\n setElapsed(0);\n deliver(new Blob(chunks, { type: next.mimeType || type || \"video/webm\" }), \"video\");\n };\n recorder.current = next;\n next.start(1000);\n setRecording(true);\n };\n\n const flip = () => {\n const side = facing === \"user\" ? \"environment\" : \"user\";\n setFacing(side);\n void start(side);\n };\n\n const accept = mode === \"video\" ? \"video/*\" : mode === \"photo\" ? \"image/*\" : \"image/*,video/*\";\n const fallback = (\n <>\n <button type=\"button\" className={s.secondary()} onClick={() => file.current?.click()}>\n {labels.fallback}\n </button>\n <input\n ref={file}\n type=\"file\"\n accept={accept}\n capture={facing}\n tabIndex={-1}\n aria-hidden\n className=\"sr-only\"\n onChange={(event) => {\n const picked = event.target.files?.[0];\n if (picked) deliver(picked, picked.type.startsWith(\"video/\") ? \"video\" : \"photo\");\n event.target.value = \"\";\n }}\n />\n </>\n );\n\n return (\n <section aria-label={labels.region} className={s.root({ className })}>\n <div className={s.stage()} style={{ aspectRatio }}>\n <video ref={video} muted playsInline aria-hidden data-mirrored={facing === \"user\" ? \"\" : undefined} className={s.video()} hidden={state !== \"live\"} />\n {state !== \"live\" && (\n <div className={s.panel()} role={state === \"denied\" || state === \"unavailable\" ? \"alert\" : undefined}>\n <span className={s.panelIcon()} aria-hidden>\n <CameraGlyph className=\"h-6 w-6\" />\n </span>\n <p className=\"max-w-xs\">{state === \"denied\" ? labels.denied : state === \"unavailable\" ? labels.unavailable : labels.prompt}</p>\n <div className=\"flex flex-wrap justify-center gap-2\">\n {(state === \"idle\" || state === \"starting\") && (\n <button type=\"button\" className={s.primary()} disabled={state === \"starting\"} onClick={() => void start(facing)}>\n <CameraGlyph className=\"h-4 w-4\" />\n {labels.start}\n </button>\n )}\n {fallback}\n </div>\n </div>\n )}\n {state === \"live\" && mode === \"both\" && !recording && (\n <div className={s.modes()}>\n <div className=\"flex gap-1 rounded-full bg-scrim-strong p-1\">\n <button type=\"button\" aria-pressed={kind === \"photo\"} className={s.mode()} onClick={() => setKind(\"photo\")}>\n {labels.photoMode}\n </button>\n <button type=\"button\" aria-pressed={kind === \"video\"} className={s.mode()} onClick={() => setKind(\"video\")}>\n {labels.videoMode}\n </button>\n </div>\n </div>\n )}\n {recording && (\n <span className={s.timer()} role=\"timer\" aria-live=\"off\">\n {formatClock(elapsed)}\n {maxDuration ? ` / ${formatClock(maxDuration)}` : \"\"}\n </span>\n )}\n {state === \"live\" && (\n <div className={s.bar()}>\n <span className=\"h-11 w-11\" />\n <button\n type=\"button\"\n className={s.shutter()}\n data-mode={kind}\n data-recording={recording ? \"\" : undefined}\n data-reduce={reduce ? \"\" : undefined}\n aria-label={kind === \"photo\" ? labels.takePhoto : recording ? labels.stopRecording : labels.startRecording}\n onClick={kind === \"photo\" ? takePhoto : toggleRecording}\n />\n <button type=\"button\" className={s.round()} aria-label={labels.switchCamera} disabled={cameras < 2 || recording} onClick={flip}>\n <FlipGlyph className=\"h-5 w-5\" />\n </button>\n </div>\n )}\n </div>\n </section>\n );\n}\n"
|
|
269
|
+
"content": "// Client. The camera in the page: asks for it only when the person presses the button (never on load), shows the\n// preview (mirrored for the front camera), takes a photo (a canvas → JPEG `Blob`) or records a clip (MediaRecorder,\n// a timer, a maximum length), switches cameras. Every dead end has a way out: permission refused, no camera, no\n// `getUserMedia` (an old browser, an insecure page) → the file picker with `capture`, which opens the phone's own\n// camera. The tracks stop when it unmounts or the page is hidden.\nimport * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { warnDeprecated } from \"../deprecated\";\nimport { CameraGlyph, FlipGlyph } from \"../glyphs\";\nimport { formatClock, playSafely, usePrefersReducedMotion } from \"../media\";\n\n/** @deprecated Since 3.55 (ADR-006, krizaka-ui#674): no product uses it. Removed in 4.0. */\nexport const mediaCapture = tv({\n slots: {\n root: \"theme-dark relative isolate flex w-full flex-col overflow-hidden rounded-xl bg-media text-fg-on-media\",\n stage: \"relative w-full\",\n video: \"absolute inset-0 h-full w-full object-cover data-[mirrored]:-scale-x-100\",\n panel: \"absolute inset-0 flex flex-col items-center justify-center gap-3 p-6 text-center text-sm\",\n panelIcon: \"flex h-12 w-12 items-center justify-center rounded-full bg-fg-on-media/15\",\n primary:\n \"inline-flex h-10 items-center justify-center gap-2 rounded-lg bg-accent px-4 text-sm font-semibold text-on-accent hover:bg-accent-hover \" +\n \"focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-media\",\n secondary:\n \"inline-flex h-10 items-center justify-center gap-2 rounded-lg border border-fg-on-media/40 px-4 text-sm font-semibold text-fg-on-media hover:bg-fg-on-media/10 \" +\n \"focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring\",\n bar: \"absolute inset-x-0 bottom-0 flex items-center justify-center gap-6 bg-linear-to-t from-scrim-strong to-transparent px-4 pb-4 pt-10\",\n shutter:\n \"relative inline-flex h-16 w-16 items-center justify-center rounded-full border-4 border-fg-on-media bg-transparent \" +\n \"focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-media \" +\n \"after:h-12 after:w-12 after:rounded-full after:bg-fg-on-media after:transition-all motion-reduce:after:transition-none \" +\n \"data-[mode=video]:after:bg-danger data-[recording]:after:h-6 data-[recording]:after:w-6 data-[recording]:after:rounded-md\",\n round:\n \"inline-flex h-11 w-11 items-center justify-center rounded-full bg-scrim-strong text-fg-on-media hover:bg-scrim \" +\n \"focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring disabled:invisible\",\n modes: \"absolute inset-x-0 top-3 flex justify-center\",\n mode:\n \"rounded-full px-3 py-1 text-xs font-semibold text-fg-on-media/80 aria-pressed:bg-fg-on-media aria-pressed:text-media \" +\n \"focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring\",\n timer:\n \"absolute left-3 top-3 inline-flex items-center gap-1.5 rounded-full bg-scrim-strong px-2.5 py-1 font-mono text-xs tabular-nums \" +\n \"before:h-2 before:w-2 before:rounded-full before:bg-danger before:animate-pulse motion-reduce:before:animate-none\",\n },\n});\n\nexport type CaptureResult = {\n /** The photo (JPEG) or the clip (WebM / MP4, as the browser records). */\n blob: Blob;\n /** `photo` or `video`. */\n kind: \"photo\" | \"video\";\n /** An object URL of the blob, to preview it (revoke it when done). */\n url: string;\n};\n\nexport type MediaCaptureLabels = {\n /** The accessible name of the camera (\"Camera\"). */\n region: string;\n /** Why the camera is asked for, before the request (\"Use your camera to take a photo\"). */\n prompt: string;\n /** The button that asks (\"Turn on the camera\"). */\n start: string;\n /** Permission refused (\"Camera access is blocked. Allow it in your browser settings, or choose a file.\"). */\n denied: string;\n /** No camera, or no access possible here (\"No camera is available.\"). */\n unavailable: string;\n /** The way out: the file picker (\"Choose a file\"). */\n fallback: string;\n takePhoto: string;\n startRecording: string;\n stopRecording: string;\n switchCamera: string;\n photoMode: string;\n videoMode: string;\n};\n\n/** @deprecated Since 3.55 (ADR-006, krizaka-ui#674): no product uses it. Removed in 4.0. */\nexport const mediaCaptureLabels: MediaCaptureLabels = {\n region: \"Camera\",\n prompt: \"Use your camera to take a photo or record a clip.\",\n start: \"Turn on the camera\",\n denied: \"Camera access is blocked. Allow it in your browser settings, or choose a file.\",\n unavailable: \"No camera is available here.\",\n fallback: \"Choose a file\",\n takePhoto: \"Take photo\",\n startRecording: \"Start recording\",\n stopRecording: \"Stop recording\",\n switchCamera: \"Switch camera\",\n photoMode: \"Photo\",\n videoMode: \"Video\",\n};\n\nexport type MediaCaptureProps = {\n /** What it captures: `photo` (default), `video`, or `both` (a switch above the preview). */\n mode?: \"photo\" | \"video\" | \"both\";\n /** The camera at first: `user` (front, mirrored, default) or `environment` (back). */\n facing?: \"user\" | \"environment\";\n /** Records the microphone with a clip. Default `true`. */\n audio?: boolean;\n /** The longest clip, in seconds: recording stops by itself. */\n maxDuration?: number;\n /** Starts the camera at mount (only when the permission is already granted — never a prompt on load). */\n autoStart?: boolean;\n /** Called with a photo taken or a clip recorded (or a file picked in the fallback). */\n onCapture: (result: CaptureResult) => void;\n /** Called when the camera cannot start (`NotAllowedError`, `NotFoundError`…). */\n onError?: (error: unknown) => void;\n /** The width / height ratio of the preview. Default `\"3 / 4\"`. */\n aspectRatio?: string;\n /** The words, passed translated; English by default. */\n labels?: Partial<MediaCaptureLabels>;\n /** Classes merged on the root. */\n className?: string;\n};\n\ntype State = \"idle\" | \"starting\" | \"live\" | \"denied\" | \"unavailable\";\n\nconst supported = () => typeof navigator !== \"undefined\" && Boolean(navigator.mediaDevices?.getUserMedia);\nconst recorderType = () =>\n typeof MediaRecorder === \"undefined\" ? undefined : [\"video/webm;codecs=vp9,opus\", \"video/webm\", \"video/mp4\"].find((t) => MediaRecorder.isTypeSupported?.(t));\n\n/**\n * The camera in the page: photo or clip, front or back, with a file-picker way out when the camera cannot start.\n * @deprecated Since 3.55 (ADR-006, krizaka-ui#674): no product uses it. Removed in 4.0.\n */\nexport function MediaCapture({\n mode = \"photo\",\n facing: initialFacing = \"user\",\n audio = true,\n maxDuration,\n autoStart,\n onCapture,\n onError,\n aspectRatio = \"3 / 4\",\n labels: given,\n className,\n}: Readonly<MediaCaptureProps>) {\n warnDeprecated(\"media-capture\");\n const labels = { ...mediaCaptureLabels, ...given };\n const s = mediaCapture();\n const reduce = usePrefersReducedMotion();\n const video = React.useRef<HTMLVideoElement>(null);\n const stream = React.useRef<MediaStream | null>(null);\n const recorder = React.useRef<MediaRecorder | null>(null);\n const file = React.useRef<HTMLInputElement>(null);\n const [state, setState] = React.useState<State>(\"idle\");\n const [facing, setFacing] = React.useState(initialFacing);\n const [kind, setKind] = React.useState<\"photo\" | \"video\">(mode === \"video\" ? \"video\" : \"photo\");\n const [recording, setRecording] = React.useState(false);\n const [elapsed, setElapsed] = React.useState(0);\n const [cameras, setCameras] = React.useState(0);\n\n const stop = React.useCallback(() => {\n if (recorder.current?.state === \"recording\") recorder.current.stop();\n stream.current?.getTracks().forEach((track) => track.stop());\n stream.current = null;\n }, []);\n\n const start = React.useCallback(\n async (side: \"user\" | \"environment\") => {\n if (!supported()) {\n setState(\"unavailable\");\n return;\n }\n setState(\"starting\");\n stop();\n try {\n const media = await navigator.mediaDevices.getUserMedia({ video: { facingMode: side }, audio: mode !== \"photo\" && audio });\n stream.current = media;\n if (video.current) {\n video.current.srcObject = media;\n playSafely(video.current);\n }\n const devices = await navigator.mediaDevices.enumerateDevices?.().catch(() => []);\n setCameras((devices ?? []).filter((d) => d.kind === \"videoinput\").length);\n setState(\"live\");\n } catch (error) {\n const name = (error as { name?: string })?.name;\n setState(name === \"NotAllowedError\" || name === \"SecurityError\" ? \"denied\" : \"unavailable\");\n onError?.(error);\n }\n },\n [audio, mode, onError, stop],\n );\n\n React.useEffect(() => {\n if (!autoStart || !supported() || !navigator.permissions?.query) return;\n let live = true;\n navigator.permissions\n .query({ name: \"camera\" as PermissionName })\n .then((status) => {\n if (live && status.state === \"granted\") void start(initialFacing);\n })\n .catch(() => undefined);\n return () => {\n live = false;\n };\n }, [autoStart, initialFacing, start]);\n\n React.useEffect(() => {\n const hide = () => {\n if (!document.hidden) return;\n stop();\n setState((current) => (current === \"live\" ? \"idle\" : current));\n };\n document.addEventListener(\"visibilitychange\", hide);\n return () => {\n document.removeEventListener(\"visibilitychange\", hide);\n stop();\n };\n }, [stop]);\n\n React.useEffect(() => {\n if (!recording) return;\n const began = Date.now();\n const timer = setInterval(() => {\n const seconds = (Date.now() - began) / 1000;\n setElapsed(seconds);\n if (maxDuration && seconds >= maxDuration) recorder.current?.stop();\n }, 250);\n return () => clearInterval(timer);\n }, [recording, maxDuration]);\n\n const deliver = (blob: Blob, captured: \"photo\" | \"video\") => onCapture({ blob, kind: captured, url: URL.createObjectURL(blob) });\n\n const takePhoto = () => {\n const element = video.current;\n if (!element?.videoWidth) return;\n const canvas = document.createElement(\"canvas\");\n canvas.width = element.videoWidth;\n canvas.height = element.videoHeight;\n const context = canvas.getContext(\"2d\");\n if (!context) return;\n if (facing === \"user\") {\n context.translate(canvas.width, 0);\n context.scale(-1, 1);\n }\n context.drawImage(element, 0, 0);\n canvas.toBlob((blob) => blob && deliver(blob, \"photo\"), \"image/jpeg\", 0.92);\n };\n\n const toggleRecording = () => {\n if (recording) {\n recorder.current?.stop();\n return;\n }\n if (!stream.current) return;\n const chunks: Blob[] = [];\n const type = recorderType();\n const next = new MediaRecorder(stream.current, type ? { mimeType: type } : undefined);\n next.ondataavailable = (event) => event.data.size && chunks.push(event.data);\n next.onstop = () => {\n setRecording(false);\n setElapsed(0);\n deliver(new Blob(chunks, { type: next.mimeType || type || \"video/webm\" }), \"video\");\n };\n recorder.current = next;\n next.start(1000);\n setRecording(true);\n };\n\n const flip = () => {\n const side = facing === \"user\" ? \"environment\" : \"user\";\n setFacing(side);\n void start(side);\n };\n\n const accept = mode === \"video\" ? \"video/*\" : mode === \"photo\" ? \"image/*\" : \"image/*,video/*\";\n const fallback = (\n <>\n <button type=\"button\" className={s.secondary()} onClick={() => file.current?.click()}>\n {labels.fallback}\n </button>\n <input\n ref={file}\n type=\"file\"\n accept={accept}\n capture={facing}\n tabIndex={-1}\n aria-hidden\n className=\"sr-only\"\n onChange={(event) => {\n const picked = event.target.files?.[0];\n if (picked) deliver(picked, picked.type.startsWith(\"video/\") ? \"video\" : \"photo\");\n event.target.value = \"\";\n }}\n />\n </>\n );\n\n return (\n <section aria-label={labels.region} className={s.root({ className })}>\n <div className={s.stage()} style={{ aspectRatio }}>\n <video ref={video} muted playsInline aria-hidden data-mirrored={facing === \"user\" ? \"\" : undefined} className={s.video()} hidden={state !== \"live\"} />\n {state !== \"live\" && (\n <div className={s.panel()} role={state === \"denied\" || state === \"unavailable\" ? \"alert\" : undefined}>\n <span className={s.panelIcon()} aria-hidden>\n <CameraGlyph className=\"h-6 w-6\" />\n </span>\n <p className=\"max-w-xs\">{state === \"denied\" ? labels.denied : state === \"unavailable\" ? labels.unavailable : labels.prompt}</p>\n <div className=\"flex flex-wrap justify-center gap-2\">\n {(state === \"idle\" || state === \"starting\") && (\n <button type=\"button\" className={s.primary()} disabled={state === \"starting\"} onClick={() => void start(facing)}>\n <CameraGlyph className=\"h-4 w-4\" />\n {labels.start}\n </button>\n )}\n {fallback}\n </div>\n </div>\n )}\n {state === \"live\" && mode === \"both\" && !recording && (\n <div className={s.modes()}>\n <div className=\"flex gap-1 rounded-full bg-scrim-strong p-1\">\n <button type=\"button\" aria-pressed={kind === \"photo\"} className={s.mode()} onClick={() => setKind(\"photo\")}>\n {labels.photoMode}\n </button>\n <button type=\"button\" aria-pressed={kind === \"video\"} className={s.mode()} onClick={() => setKind(\"video\")}>\n {labels.videoMode}\n </button>\n </div>\n </div>\n )}\n {recording && (\n <span className={s.timer()} role=\"timer\" aria-live=\"off\">\n {formatClock(elapsed)}\n {maxDuration ? ` / ${formatClock(maxDuration)}` : \"\"}\n </span>\n )}\n {state === \"live\" && (\n <div className={s.bar()}>\n <span className=\"h-11 w-11\" />\n <button\n type=\"button\"\n className={s.shutter()}\n data-mode={kind}\n data-recording={recording ? \"\" : undefined}\n data-reduce={reduce ? \"\" : undefined}\n aria-label={kind === \"photo\" ? labels.takePhoto : recording ? labels.stopRecording : labels.startRecording}\n onClick={kind === \"photo\" ? takePhoto : toggleRecording}\n />\n <button type=\"button\" className={s.round()} aria-label={labels.switchCamera} disabled={cameras < 2 || recording} onClick={flip}>\n <FlipGlyph className=\"h-5 w-5\" />\n </button>\n </div>\n )}\n </div>\n </section>\n );\n}\n"
|
|
270
270
|
},
|
|
271
271
|
{
|
|
272
272
|
"path": "media-capture/meta.ts",
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
"files": [
|
|
164
164
|
{
|
|
165
165
|
"path": "glyphs.tsx",
|
|
166
|
-
"content": "// The small line glyphs the data and media primitives draw (play, volume, search, chevrons…): decorative, 24-unit\n// box, `currentColor`, sized by the caller's class. Shared by the entries that need them; never exported on its own —\n// a product draws its own icons with @krizaka/icons.\nimport type * as React from \"react\";\n\ntype GlyphProps = { className?: string };\n\nfunction Glyph({ className = \"h-4 w-4\", fill, children }: GlyphProps & { fill?: boolean; children: React.ReactNode }) {\n return (\n <svg\n viewBox=\"0 0 24 24\"\n className={className}\n fill={fill ? \"currentColor\" : \"none\"}\n stroke={fill ? \"none\" : \"currentColor\"}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden\n focusable=\"false\"\n >\n {children}\n </svg>\n );\n}\n\nexport const PlayGlyph = (p: GlyphProps) => (\n <Glyph {...p} fill>\n <path d=\"M8 5.5v13a1 1 0 0 0 1.5.86l10.4-6.5a1 1 0 0 0 0-1.72L9.5 4.64A1 1 0 0 0 8 5.5Z\" />\n </Glyph>\n);\nexport const PauseGlyph = (p: GlyphProps) => (\n <Glyph {...p} fill>\n <rect x=\"6\" y=\"5\" width=\"4\" height=\"14\" rx=\"1\" />\n <rect x=\"14\" y=\"5\" width=\"4\" height=\"14\" rx=\"1\" />\n </Glyph>\n);\nexport const VolumeGlyph = ({ muted, ...p }: GlyphProps & { muted?: boolean }) => (\n <Glyph {...p}>\n <path d=\"M11 5 6 9H3v6h3l5 4V5Z\" />\n {muted ? <path d=\"m22 9-6 6m0-6 6 6\" /> : <path d=\"M15.5 8.5a5 5 0 0 1 0 7M18.5 5.5a9 9 0 0 1 0 13\" />}\n </Glyph>\n);\nexport const FullscreenGlyph = ({ exit, ...p }: GlyphProps & { exit?: boolean }) => (\n <Glyph {...p}>\n {exit ? <path d=\"M9 4v5H4m11-5v5h5M9 20v-5H4m11 5v-5h5\" /> : <path d=\"M4 9V4h5m6 0h5v5M4 15v5h5m11-5v5h-5\" />}\n </Glyph>\n);\nexport const CaptionsGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\" />\n <path d=\"M10 10.5a2 2 0 1 0 0 3M17 10.5a2 2 0 1 0 0 3\" />\n </Glyph>\n);\nexport const PipGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\" />\n <rect x=\"12\" y=\"12\" width=\"6\" height=\"4\" rx=\"1\" />\n </Glyph>\n);\nexport const SearchGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <circle cx=\"11\" cy=\"11\" r=\"7\" />\n <path d=\"m20 20-3.5-3.5\" />\n </Glyph>\n);\nexport const CloseGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M18 6 6 18M6 6l12 12\" />\n </Glyph>\n);\nexport const ChevronGlyph = ({ direction = \"down\", ...p }: GlyphProps & { direction?: \"left\" | \"right\" | \"up\" | \"down\" }) => (\n <Glyph {...p}>\n <path d={{ left: \"m15 6-6 6 6 6\", right: \"m9 6 6 6-6 6\", up: \"m6 15 6-6 6 6\", down: \"m6 9 6 6 6-6\" }[direction]} />\n </Glyph>\n);\nexport const CheckGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M20 6 9 17l-5-5\" />\n </Glyph>\n);\nexport const PlusGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M12 5v14M5 12h14\" />\n </Glyph>\n);\nexport const CalendarGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <rect x=\"3\" y=\"5\" width=\"18\" height=\"16\" rx=\"2\" />\n <path d=\"M3 10h18M8 3v4M16 3v4\" />\n </Glyph>\n);\nexport const UploadGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M12 16V4m0 0L7 9m5-5 5 5\" />\n <path d=\"M4 16v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2\" />\n </Glyph>\n);\nexport const FileGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8l-5-5Z\" />\n <path d=\"M14 3v5h5\" />\n </Glyph>\n);\nexport const CameraGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M4 8h3l2-3h6l2 3h3a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1Z\" />\n <circle cx=\"12\" cy=\"13.5\" r=\"3.5\" />\n </Glyph>\n);\nexport const FlipGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M4 12a8 8 0 0 1 14-5.3M20 12a8 8 0 0 1-14 5.3\" />\n <path d=\"M18 3v4h-4M6 21v-4h4\" />\n </Glyph>\n);\nexport const RetryGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M4 12a8 8 0 1 0 2.3-5.7L4 8.5\" />\n <path d=\"M4 4v4.5h4.5\" />\n </Glyph>\n);\nexport const SortGlyph = ({ direction, ...p }: GlyphProps & { direction?: \"ascending\" | \"descending\" }) => (\n <Glyph {...p}>\n {direction === \"ascending\" ? <path d=\"m7 14 5-5 5 5\" /> : direction === \"descending\" ? <path d=\"m7 10 5 5 5-5\" /> : <path d=\"m8 9 4-4 4 4M8 15l4 4 4-4\" />}\n </Glyph>\n);\nexport const ArrowGlyph = ({ direction = \"right\", ...p }: GlyphProps & { direction?: \"left\" | \"right\" }) => (\n <Glyph {...p}>\n <path d={direction === \"left\" ? \"M19 12H5m0 0 6-6m-6 6 6 6\" : \"M5 12h14m0 0-6-6m6 6-6 6\"} />\n </Glyph>\n);\nexport const ExternalGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M14 4h6v6M20 4l-9 9\" />\n <path d=\"M18 14v4a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4\" />\n </Glyph>\n);\nexport const WarningGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M12 4 2.5 20h19L12 4Z\" />\n <path d=\"M12 10v4M12 17.2v.1\" />\n </Glyph>\n);\nexport const CopyGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <rect x=\"9\" y=\"9\" width=\"11\" height=\"11\" rx=\"2\" />\n <path d=\"M15 9V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h3\" />\n </Glyph>\n);\nexport const PencilGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M4 20h4L19 9a2.8 2.8 0 0 0-4-4L4 16v4zM13.5 6.5l4 4\" />\n </Glyph>\n);\n"
|
|
166
|
+
"content": "// The small line glyphs the data and media primitives draw (play, volume, search, chevrons…): decorative, 24-unit\n// box, `currentColor`, sized by the caller's class. Shared by the entries that need them; never exported on its own —\n// a product draws its own icons with @krizaka/icons.\nimport type * as React from \"react\";\n\ntype GlyphProps = { className?: string };\n\nfunction Glyph({ className = \"h-4 w-4\", fill, children }: Readonly<GlyphProps & { fill?: boolean; children: React.ReactNode }>) {\n return (\n <svg\n viewBox=\"0 0 24 24\"\n className={className}\n fill={fill ? \"currentColor\" : \"none\"}\n stroke={fill ? \"none\" : \"currentColor\"}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden\n focusable=\"false\"\n >\n {children}\n </svg>\n );\n}\n\nexport const PlayGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p} fill>\n <path d=\"M8 5.5v13a1 1 0 0 0 1.5.86l10.4-6.5a1 1 0 0 0 0-1.72L9.5 4.64A1 1 0 0 0 8 5.5Z\" />\n </Glyph>\n);\nexport const PauseGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p} fill>\n <rect x=\"6\" y=\"5\" width=\"4\" height=\"14\" rx=\"1\" />\n <rect x=\"14\" y=\"5\" width=\"4\" height=\"14\" rx=\"1\" />\n </Glyph>\n);\nexport const VolumeGlyph = ({ muted, ...p }: Readonly<GlyphProps & { muted?: boolean }>) => (\n <Glyph {...p}>\n <path d=\"M11 5 6 9H3v6h3l5 4V5Z\" />\n {muted ? <path d=\"m22 9-6 6m0-6 6 6\" /> : <path d=\"M15.5 8.5a5 5 0 0 1 0 7M18.5 5.5a9 9 0 0 1 0 13\" />}\n </Glyph>\n);\nexport const FullscreenGlyph = ({ exit, ...p }: Readonly<GlyphProps & { exit?: boolean }>) => (\n <Glyph {...p}>\n {exit ? <path d=\"M9 4v5H4m11-5v5h5M9 20v-5H4m11 5v-5h5\" /> : <path d=\"M4 9V4h5m6 0h5v5M4 15v5h5m11-5v5h-5\" />}\n </Glyph>\n);\nexport const CaptionsGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p}>\n <rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\" />\n <path d=\"M10 10.5a2 2 0 1 0 0 3M17 10.5a2 2 0 1 0 0 3\" />\n </Glyph>\n);\nexport const PipGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p}>\n <rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\" />\n <rect x=\"12\" y=\"12\" width=\"6\" height=\"4\" rx=\"1\" />\n </Glyph>\n);\nexport const SearchGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p}>\n <circle cx=\"11\" cy=\"11\" r=\"7\" />\n <path d=\"m20 20-3.5-3.5\" />\n </Glyph>\n);\nexport const CloseGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p}>\n <path d=\"M18 6 6 18M6 6l12 12\" />\n </Glyph>\n);\nexport const ChevronGlyph = ({ direction = \"down\", ...p }: Readonly<GlyphProps & { direction?: \"left\" | \"right\" | \"up\" | \"down\" }>) => (\n <Glyph {...p}>\n <path d={{ left: \"m15 6-6 6 6 6\", right: \"m9 6 6 6-6 6\", up: \"m6 15 6-6 6 6\", down: \"m6 9 6 6 6-6\" }[direction]} />\n </Glyph>\n);\nexport const CheckGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p}>\n <path d=\"M20 6 9 17l-5-5\" />\n </Glyph>\n);\nexport const PlusGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p}>\n <path d=\"M12 5v14M5 12h14\" />\n </Glyph>\n);\nexport const CalendarGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p}>\n <rect x=\"3\" y=\"5\" width=\"18\" height=\"16\" rx=\"2\" />\n <path d=\"M3 10h18M8 3v4M16 3v4\" />\n </Glyph>\n);\nexport const UploadGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p}>\n <path d=\"M12 16V4m0 0L7 9m5-5 5 5\" />\n <path d=\"M4 16v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2\" />\n </Glyph>\n);\nexport const FileGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p}>\n <path d=\"M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8l-5-5Z\" />\n <path d=\"M14 3v5h5\" />\n </Glyph>\n);\nexport const CameraGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p}>\n <path d=\"M4 8h3l2-3h6l2 3h3a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1Z\" />\n <circle cx=\"12\" cy=\"13.5\" r=\"3.5\" />\n </Glyph>\n);\nexport const FlipGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p}>\n <path d=\"M4 12a8 8 0 0 1 14-5.3M20 12a8 8 0 0 1-14 5.3\" />\n <path d=\"M18 3v4h-4M6 21v-4h4\" />\n </Glyph>\n);\nexport const RetryGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p}>\n <path d=\"M4 12a8 8 0 1 0 2.3-5.7L4 8.5\" />\n <path d=\"M4 4v4.5h4.5\" />\n </Glyph>\n);\nexport const SortGlyph = ({ direction, ...p }: Readonly<GlyphProps & { direction?: \"ascending\" | \"descending\" }>) => (\n <Glyph {...p}>\n {direction === \"ascending\" ? <path d=\"m7 14 5-5 5 5\" /> : direction === \"descending\" ? <path d=\"m7 10 5 5 5-5\" /> : <path d=\"m8 9 4-4 4 4M8 15l4 4 4-4\" />}\n </Glyph>\n);\nexport const ArrowGlyph = ({ direction = \"right\", ...p }: Readonly<GlyphProps & { direction?: \"left\" | \"right\" }>) => (\n <Glyph {...p}>\n <path d={direction === \"left\" ? \"M19 12H5m0 0 6-6m-6 6 6 6\" : \"M5 12h14m0 0-6-6m6 6-6 6\"} />\n </Glyph>\n);\nexport const ExternalGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p}>\n <path d=\"M14 4h6v6M20 4l-9 9\" />\n <path d=\"M18 14v4a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4\" />\n </Glyph>\n);\nexport const WarningGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p}>\n <path d=\"M12 4 2.5 20h19L12 4Z\" />\n <path d=\"M12 10v4M12 17.2v.1\" />\n </Glyph>\n);\nexport const CopyGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p}>\n <rect x=\"9\" y=\"9\" width=\"11\" height=\"11\" rx=\"2\" />\n <path d=\"M15 9V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h3\" />\n </Glyph>\n);\nexport const PencilGlyph = (p: Readonly<GlyphProps>) => (\n <Glyph {...p}>\n <path d=\"M4 20h4L19 9a2.8 2.8 0 0 0-4-4L4 16v4zM13.5 6.5l4 4\" />\n </Glyph>\n);\n"
|
|
167
167
|
},
|
|
168
168
|
{
|
|
169
169
|
"path": "media-gallery/carousel-index.ts",
|
|
@@ -199,15 +199,15 @@
|
|
|
199
199
|
},
|
|
200
200
|
{
|
|
201
201
|
"path": "media-gallery/media-carousel.tsx",
|
|
202
|
-
"content": "// Client (the slide in view, the clock, the reader's motion, data and sound choices). Carousel v2 (ADR-010): a sequence of\n// clips, screen demos and stills given as data, one at a time in one frame. The slides cross-fade in place (nothing\n// travels); previous / next sit in a toolbar that also takes ← → Home End, a swipe turns one slide, a « n / N » count.\n// With `autoplay` it advances by itself at the media's pace — the clock IS the CSS animation of the current progress\n// tick, so holding it (the pause button, the pointer, the keyboard focus, a hidden tab, off screen) keeps it where it\n// stood. Under reduced motion or Save-Data nothing advances and no clip is mounted: the posters and the buttons.\n// Posters first, one clip (the slide in view) after the page's `load`; a clip that cannot play leaves its poster. Sound is\n// an option: after a press on « Sound on », hovering or focusing the carousel plays the slide's audio.\nimport * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { IconButton } from \"../button/button\";\nimport { ChevronGlyph, PauseGlyph, PlayGlyph, VolumeGlyph } from \"../glyphs\";\nimport { clamp, playSafely, useCalm, useInView, usePageHidden, usePageLoaded } from \"../media\";\nimport { MediaPlayer, type MediaPlayerProps } from \"./media-player\";\n\nexport const mediaCarousel = tv({\n slots: {\n root: \"relative isolate w-full min-w-0\",\n stage: \"relative isolate w-full overflow-hidden bg-media\",\n track: \"m-0 grid list-none p-0 touch-pan-y\",\n slide: \"relative col-start-1 row-start-1 m-0 w-full overflow-hidden opacity-0 transition-opacity duration-500 motion-reduce:transition-none data-[active]:opacity-100\",\n media: \"absolute inset-0 h-full w-full object-cover\",\n caption: \"absolute inset-x-0 bottom-0 bg-linear-to-t from-scrim-strong to-transparent p-3 pt-8 text-xs font-semibold text-fg-on-media\",\n ticks: \"pointer-events-none absolute inset-x-3 bottom-2.5 z-10 flex gap-1.5\",\n tick: \"relative h-0.5 flex-1 overflow-hidden bg-fg-on-media/30 data-[state=done]:bg-fg-on-media data-[state=full]:bg-[var(--kz-hue,var(--kz-accent))]\",\n fill: \"kz-media-carousel-fill absolute inset-0 bg-[var(--kz-hue,var(--kz-accent))]\",\n mark: \"absolute top-0 h-full w-px bg-media\",\n bar: \"mt-3 flex items-start justify-between gap-3\",\n barCaption: \"m-0 min-w-0 font-mono text-[13px] leading-[19px] text-fg-secondary [overflow-wrap:anywhere]\",\n count: \"text-xs tabular-nums text-fg-secondary\",\n buttons: \"flex flex-none gap-2\",\n text: \"mt-2.5 text-sm text-fg-secondary [&_li]:my-1\",\n },\n variants: {\n frame: {\n product: { stage: \"rounded-xl border border-border-default\" },\n cahier: { stage: \"rounded-none border border-border-strong shadow-[4px_4px_0_var(--kz-border-strong)]\", count: \"mr-2.5 font-mono text-fg-primary\" },\n },\n },\n defaultVariants: { frame: \"product\" },\n});\n\n/** What a slide is: a clip (a short generated or filmed shot), a screen demo (a product journey, often with chapters), a still. */\nexport type CarouselSlideKind = \"clip\" | \"screen-demo\" | \"still\";\n/** A step of a screen demo: where it starts, in seconds, and its name. */\nexport type CarouselChapter = { at: number; label: string };\n\nexport type CarouselSlide = {\n /** A stable id. */\n id: string;\n /** What it is. Default: `clip` with a `video`, `still` without. */\n kind?: CarouselSlideKind;\n /** The poster of a clip or a film, or the still: 16:9, drawn first. */\n src: string;\n /** What it shows, in words. */\n alt: string;\n /** « Fig. 1a — … »: over the foot of the slide, or in the bar with `caption=\"bar\"`. */\n caption?: string;\n /** The slide's line in the text version; `alt` when absent. */\n text?: string;\n /** The clip: one rendition, two encodes (VP9 `webm` first, H.264 `mp4` for Safari). Muted; plays while the slide is in view, on screen, after the page's `load`; never under reduced motion or Save-Data. */\n video?: { webm?: string; mp4?: string };\n /** The clip's length in seconds, as measured on the file (`krizaka-media-guard` reports it): with `autoplay`, the slide's time on screen. */\n duration?: number;\n /** The clip's file has an audio track (the guard checks it says the truth): « Sound on » can then play it. */\n audio?: boolean;\n /** A screen demo's steps: marks on the progress tick, the caption follows the step under the playhead, listed in the text version. */\n chapters?: readonly CarouselChapter[];\n /** A film opened by a press, with sound, in the lightbox of the MediaPlayer. */\n film?: Pick<MediaPlayerProps, \"src\" | \"title\" | \"tracks\" | \"loadHls\" | \"labels\" | \"ratio\"> & { playLabel: string; vertical?: boolean };\n};\n\nexport type MediaCarouselLabels = {\n previous: string;\n next: string;\n close: string;\n /** A slide's name, with `{n}` and `{total}`. */\n slide: string;\n /** The pause button while something moves. */\n pause: string;\n /** The same button once paused. */\n play: string;\n /** The sound toggle (pressed or not). */\n soundOn: string;\n /** The summary of the text version. */\n textVersion: string;\n /** The carousel's role description (`aria-roledescription`). */\n carousel: string;\n /** A slide's role description. */\n slideRole: string;\n};\nexport const mediaCarouselLabels: MediaCarouselLabels = {\n previous: \"Previous\",\n next: \"Next\",\n close: \"Close\",\n slide: \"{n} of {total}\",\n pause: \"Pause the carousel\",\n play: \"Play the carousel\",\n soundOn: \"Sound on\",\n textVersion: \"Text version\",\n carousel: \"carousel\",\n slideRole: \"slide\",\n};\n\n/** The bounds of a slide's time on screen, in seconds. */\nexport type CarouselAutoplay = { minDwell?: number; maxDwell?: number };\n\n// @fixed: the shortest time a slide stays, in seconds: reading a caption (ADR-010 §3), not a setting.\nexport const CAROUSEL_MIN_DWELL = 5;\n// @fixed: the longest, in seconds: the longest screen journey of a product demo (krizaka-internal#2655).\nexport const CAROUSEL_MAX_DWELL = 45;\n// @fixed: a still (or a clip of unknown length) stays a reading time and a breath, in seconds.\nconst STILL_EXTRA = 1.5;\n\n/** How long a slide stays with `autoplay`, in milliseconds: its media's duration within the bounds, or a reading time for a still. */\nexport function carouselDwell(slide: Pick<CarouselSlide, \"duration\" | \"video\">, bounds: CarouselAutoplay = {}): number {\n const min = bounds.minDwell ?? CAROUSEL_MIN_DWELL;\n const max = Math.max(min, bounds.maxDwell ?? CAROUSEL_MAX_DWELL);\n const seconds = slide.video && slide.duration && slide.duration > 0 ? clamp(slide.duration, min, max) : clamp(min + STILL_EXTRA, min, max);\n return Math.round(seconds * 1000);\n}\n\n/** The chapter under the playhead: the last one that has started. */\nexport function chapterAt(chapters: readonly CarouselChapter[] | undefined, seconds: number): number {\n if (!chapters?.length) return -1;\n let found = -1;\n chapters.forEach((c, i) => {\n if (seconds >= c.at) found = i;\n });\n return found;\n}\n\nexport type MediaCarouselProps = Omit<React.ComponentProps<\"section\">, \"children\"> & {\n /** The slides, in order. */\n slides: readonly CarouselSlide[];\n /** The carousel's accessible name, passed translated. */\n label: string;\n /** The frame ratio of every slide (width / height). Default `16 / 9`, the house ratio. */\n ratio?: string;\n /** Advances by itself (wrapping), each slide for its `duration` within the bounds (`true`: 5–45 s). Never under reduced motion or Save-Data; held by the pause button, a hidden tab, off screen (and, with `holds=\"pointer-focus\"`, the pointer and a keyboard focus). */\n autoplay?: boolean | CarouselAutoplay;\n /** What holds the autoplay clock besides the visible pause, a hidden tab, off screen, reduced motion and Save-Data. `pause-only` (default, WCAG 2.2.2): nothing else, so a resting pointer or a click on next never freezes it. `pointer-focus`: the pointer (not a touch) and a keyboard focus inside hold it too. */\n holds?: \"pause-only\" | \"pointer-focus\";\n /** Offers « Sound on » when a slide declares `audio`: after the press, hovering or focusing the carousel plays that slide's sound. Never without the press. */\n sound?: boolean;\n /** `product` (default): the product register's rounded frame. `cahier`: the company's sites — square, a solid paper shadow, the count in the typewriter face. */\n frame?: \"product\" | \"cahier\";\n /** Where a slide's caption sits: over its foot (`overlay`, default) or in the bar under the frame (`bar`). */\n caption?: \"overlay\" | \"bar\";\n /** Renders the text version under the carousel: every slide's caption and text (and chapters), in a native `<details>`. */\n textVersion?: boolean;\n /** Rendered inside the text version (the host's sources, a link to the film); after the carousel without one. */\n children?: React.ReactNode;\n /** The words, passed translated; English by default. `slide` takes `{n}` and `{total}`. */\n labels?: Partial<MediaCarouselLabels>;\n /** The words of the lightbox player of every film (speed, captions, time…), passed translated; a slide's own `film.labels` wins. */\n playerLabels?: MediaPlayerProps[\"labels\"];\n /** Called with the index of the slide in view when it changes. */\n onSlideChange?: (index: number) => void;\n /**\n * Draws a slide's `video` in place of the carousel's own clip.\n * @deprecated Since carousel v2 (ADR-010) the carousel draws its clips itself, with its pause in the toolbar. Removed in 4.0.\n */\n renderLoop?: (video: NonNullable<CarouselSlide[\"video\"]>, context: { poster: string; inView: boolean }) => React.ReactNode;\n};\n\nconst CLOCK_CSS =\n \".kz-media-carousel-fill{transform-origin:left;transform:scaleX(0);animation-name:kz-media-carousel-fill;animation-timing-function:linear;animation-fill-mode:forwards}\" +\n \"@keyframes kz-media-carousel-fill{from{transform:scaleX(0)}to{transform:scaleX(1)}}\";\n\n/** How far a swipe travels, in CSS pixels, before it turns the slide. */\nconst SWIPE_DISTANCE = 40;\nconst SOUND_KEY = \"kz-media-carousel-sound\";\nconst SOUND_EVENT = \"kz-media-carousel-sound\";\n\n/** A horizontal swipe turns one slide; a vertical one stays the page's scroll (`touch-action: pan-y`). */\nfunction useSwipe(turn: (delta: 1 | -1) => void) {\n const from = React.useRef<number | null>(null);\n return {\n onPointerDown: (event: React.PointerEvent) => {\n from.current = event.clientX;\n },\n onPointerUp: (event: React.PointerEvent) => {\n const start = from.current;\n from.current = null;\n if (start === null) return;\n const distance = event.clientX - start;\n if (Math.abs(distance) >= SWIPE_DISTANCE) turn(distance < 0 ? 1 : -1);\n },\n onPointerCancel: () => {\n from.current = null;\n },\n };\n}\n\nconst subscribeSound = (notify: () => void) => {\n globalThis.addEventListener(SOUND_EVENT, notify);\n return () => globalThis.removeEventListener(SOUND_EVENT, notify);\n};\nconst readSound = () => {\n try {\n return globalThis.sessionStorage.getItem(SOUND_KEY) === \"1\";\n } catch {\n return false;\n }\n};\n/** The visitor's choice of sound, for this session (off on the server and before any press). */\nfunction useSoundChoice(): [boolean, () => void] {\n const on = React.useSyncExternalStore(subscribeSound, readSound, () => false);\n const toggle = () => {\n try {\n globalThis.sessionStorage.setItem(SOUND_KEY, on ? \"0\" : \"1\");\n } catch {\n // No storage (a private window): the choice holds until the next render only.\n }\n globalThis.dispatchEvent(new Event(SOUND_EVENT));\n };\n return [on, toggle];\n}\n\n/** The keyboard put the focus there (`:focus-visible`): only then does a focus hold the clock; a click does not. */\nfunction keyboardFocus(target: EventTarget | null): boolean {\n try {\n return target instanceof Element && target.matches(\":focus-visible\");\n } catch {\n return true;\n }\n}\n\n/** At an end the button just used is disabled: the focus moves to the other one, never to the page. */\nfunction keepFocus(toolbar: HTMLElement | null, at: number, count: number) {\n if (!toolbar?.contains(document.activeElement)) return;\n const buttons = toolbar.querySelectorAll(\"button\");\n const previous = buttons[0];\n const next = buttons[buttons.length - 1];\n if (at === 0) next?.focus();\n if (at === count - 1) previous?.focus();\n}\n\ntype ClipProps = Readonly<{\n video: NonNullable<CarouselSlide[\"video\"]>;\n poster: string;\n playing: boolean;\n muted: boolean;\n onBroken: () => void;\n onTime?: (seconds: number) => void;\n}>;\n\n/** The slide's clip: muted until the sound is chosen, looping while its slide stays (never a held last frame), gone if no source plays. */\nfunction SlideClip({ video, poster, playing, muted, onBroken, onTime }: ClipProps) {\n const ref = React.useRef<HTMLVideoElement>(null);\n React.useEffect(() => {\n if (ref.current) ref.current.muted = muted;\n }, [muted]);\n React.useEffect(() => {\n if (!ref.current) return;\n if (playing) playSafely(ref.current);\n else ref.current.pause?.();\n }, [playing]);\n const last = video.mp4 ? \"mp4\" : \"webm\";\n return (\n <video\n ref={ref}\n className={mediaCarousel().media()}\n poster={poster}\n muted\n loop\n playsInline\n preload=\"auto\"\n aria-hidden\n tabIndex={-1}\n onTimeUpdate={onTime ? (e) => onTime(e.currentTarget.currentTime) : undefined}\n >\n {video.webm && <source src={video.webm} type=\"video/webm\" onError={last === \"webm\" ? onBroken : undefined} />}\n {video.mp4 && <source src={video.mp4} type=\"video/mp4\" onError={onBroken} />}\n </video>\n );\n}\n\ntype SlideMediaProps = Readonly<{ slide: CarouselSlide; first: boolean; drawn: boolean; clip: React.ReactNode; ratio: string; closeLabel: string; overlay: boolean; playerLabels?: MediaPlayerProps[\"labels\"] }>;\n\n/** A poster that opens its film, or a still; its clip plays over it while the slide is the one in view. */\nfunction SlideMedia({ slide, first, drawn, clip, ratio, closeLabel, overlay, playerLabels }: SlideMediaProps) {\n const s = mediaCarousel();\n if (slide.film) {\n return (\n <MediaPlayer\n {...slide.film}\n labels={slide.film.labels ?? playerLabels}\n mode=\"lightbox\"\n poster={slide.src}\n posterAlt={slide.alt}\n caption={overlay ? slide.caption : undefined}\n closeLabel={closeLabel}\n preview={clip}\n className=\"h-full rounded-none border-0\"\n />\n );\n }\n return (\n <>\n {drawn && <img src={slide.src} alt={slide.alt} loading={first ? undefined : \"lazy\"} decoding=\"async\" draggable={false} className={s.media()} style={{ aspectRatio: ratio }} />}\n {clip}\n {overlay && slide.caption && <figcaption className={s.caption()}>{slide.caption}</figcaption>}\n </>\n );\n}\n\n/** A tick's state: before the current one, the current one (filling, or full when nothing advances), still to come. */\nfunction tickState(i: number, active: number, filling: boolean): \"done\" | \"now\" | \"full\" | undefined {\n if (i < active) return \"done\";\n if (i !== active) return undefined;\n return filling ? \"now\" : \"full\";\n}\n\n/** A screen demo's steps, as marks on its progress tick (where each starts, over the clip's length). */\nfunction ChapterMarks({ slide, className }: Readonly<{ slide: CarouselSlide; className: string }>) {\n const length = slide.duration ?? 0;\n if (!slide.chapters?.length || length <= 0) return null;\n return slide.chapters.map((c) => <i key={c.at} className={className} style={{ left: `${(c.at / length) * 100}%` }} />);\n}\n\n/** The step of the current slide under the playhead, followed only for a slide with chapters. */\nfunction useChapter(slide: CarouselSlide | undefined) {\n const [chapter, setChapter] = React.useState(-1);\n const [shown, setShown] = React.useState(slide?.id);\n if (shown !== slide?.id) {\n setShown(slide?.id);\n setChapter(-1);\n }\n const onTime = slide?.chapters?.length ? (seconds: number) => setChapter(chapterAt(slide.chapters, seconds)) : undefined;\n return { chapter: slide?.chapters?.[chapter], onTime };\n}\n\n/** What holds the clock and what lets the sound play: the pointer (not a touch), any focus inside, a keyboard focus inside. */\nfunction useHolds() {\n const [hovered, setHovered] = React.useState(false);\n const [focusIn, setFocusIn] = React.useState(false);\n const [keyboardIn, setKeyboardIn] = React.useState(false);\n const handlers = {\n onPointerEnter: (e: React.PointerEvent) => setHovered(e.pointerType !== \"touch\"),\n onPointerLeave: () => setHovered(false),\n onFocus: (e: React.FocusEvent) => {\n setFocusIn(true);\n setKeyboardIn(keyboardFocus(e.target));\n },\n onBlur: (e: React.FocusEvent) => {\n if (e.currentTarget.contains(e.relatedTarget as Node | null)) return;\n setFocusIn(false);\n setKeyboardIn(false);\n },\n };\n return { hovered, focusIn, keyboardIn, handlers };\n}\n\ntype TicksProps = Readonly<{ slides: readonly CarouselSlide[]; active: number; calm: boolean; dwell: number; advancing: boolean; onEnd: () => void; s: ReturnType<typeof mediaCarousel> }>;\n\n/** One hairline per slide; the current one fills over its dwell — the clock — and holds with the carousel. */\nfunction CarouselTicks({ slides, active, calm, dwell, advancing, onEnd, s }: TicksProps) {\n return (\n <div className={s.ticks()} aria-hidden>\n {slides.map((slide, i) => (\n <span key={slide.id} className={s.tick()} data-state={tickState(i, active, !calm)}>\n {i === active && !calm && (\n <span\n key={`${active}`}\n className={s.fill()}\n style={{ animationDuration: `${dwell}ms`, animationPlayState: advancing ? \"running\" : \"paused\" }}\n onAnimationEnd={() => advancing && onEnd()}\n />\n )}\n {i === active && <ChapterMarks slide={slide} className={s.mark()} />}\n </span>\n ))}\n </div>\n );\n}\n\ntype ToolbarProps = Readonly<{\n labels: MediaCarouselLabels;\n turns: boolean;\n atStart: boolean;\n atEnd: boolean;\n moving: boolean;\n paused: boolean;\n onPause: () => void;\n sound: { shown: boolean; on: boolean; toggle: () => void };\n onTurn: (delta: number) => void;\n onKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => void;\n className: string;\n}>;\n\n/** Previous, pause / play, « Sound on », next: one toolbar that also takes ← → Home End. */\nconst CarouselToolbar = React.forwardRef<HTMLDivElement, ToolbarProps>(function CarouselToolbar(\n { labels, turns, atStart, atEnd, moving, paused, onPause, sound, onTurn, onKeyDown, className },\n ref,\n) {\n return (\n <div ref={ref} role=\"toolbar\" aria-orientation=\"horizontal\" className={className} onKeyDown={onKeyDown}>\n {turns && (\n <IconButton variant=\"secondary\" label={labels.previous} disabled={atStart} onClick={() => onTurn(-1)}>\n <ChevronGlyph direction=\"left\" className=\"h-5 w-5\" />\n </IconButton>\n )}\n {moving && (\n <IconButton variant=\"secondary\" label={paused ? labels.play : labels.pause} aria-pressed={paused} onClick={onPause}>\n {paused ? <PlayGlyph className=\"h-4 w-4\" /> : <PauseGlyph className=\"h-4 w-4\" />}\n </IconButton>\n )}\n {sound.shown && (\n <IconButton variant=\"secondary\" label={labels.soundOn} aria-pressed={sound.on} onClick={sound.toggle}>\n <VolumeGlyph muted={!sound.on} className=\"h-4 w-4\" />\n </IconButton>\n )}\n {turns && (\n <IconButton variant=\"secondary\" label={labels.next} disabled={atEnd} onClick={() => onTurn(1)}>\n <ChevronGlyph direction=\"right\" className=\"h-5 w-5\" />\n </IconButton>\n )}\n </div>\n );\n});\n\n/** Every slide's caption and text, and a screen demo's chapters, in a native `<details>`; the host's `children` inside. */\nfunction TextVersion({ slides, summary, className, children }: Readonly<{ slides: readonly CarouselSlide[]; summary: string; className: string; children?: React.ReactNode }>) {\n return (\n <details className={className}>\n <summary>{summary}</summary>\n <ol>\n {slides.map((slide) => (\n <li key={slide.id}>\n {slide.caption && <b>{slide.caption}</b>} {slide.text ?? slide.alt}\n {slide.chapters?.length ? (\n <ol>\n {slide.chapters.map((c) => (\n <li key={c.at}>{c.label}</li>\n ))}\n </ol>\n ) : null}\n </li>\n ))}\n </ol>\n {children}\n </details>\n );\n}\n\n/** The caption shown in the bar: the slide's, with the chapter under the playhead. */\nfunction barCaptionOf(placement: \"overlay\" | \"bar\", slide: CarouselSlide | undefined, chapter: CarouselChapter | undefined) {\n if (placement !== \"bar\" || !slide?.caption) return undefined;\n return chapter ? [slide.caption, chapter.label].join(\" · \") : slide.caption;\n}\n\n/** A sequence of clips, screen demos and stills, one at a time: buttons, arrow keys, swipe, and with `autoplay` it advances at the media's pace. */\nexport function MediaCarousel({\n slides,\n label,\n ratio = \"16 / 9\",\n autoplay,\n holds = \"pause-only\",\n sound,\n frame = \"product\",\n caption = \"overlay\",\n textVersion,\n children,\n labels: given,\n playerLabels,\n onSlideChange,\n renderLoop,\n className,\n ...props\n}: Readonly<MediaCarouselProps>) {\n const labels = { ...mediaCarouselLabels, ...given };\n const s = mediaCarousel({ frame });\n const total = slides.length;\n const root = React.useRef<HTMLElement>(null);\n const toolbar = React.useRef<HTMLDivElement>(null);\n const calm = useCalm();\n const loaded = usePageLoaded();\n const hidden = usePageHidden();\n const [soundChosen, toggleSound] = useSoundChoice();\n const [active, setActive] = React.useState(0);\n const [seen, setSeen] = React.useState<ReadonlySet<number>>(() => new Set([0]));\n const [broken, setBroken] = React.useState<ReadonlySet<string>>(() => new Set());\n const [paused, setPaused] = React.useState(false);\n const { hovered, focusIn, keyboardIn, handlers } = useHolds();\n const [onScreen, setOnScreen] = React.useState(() => typeof IntersectionObserver === \"undefined\");\n useInView(root, setOnScreen);\n\n const current = slides[active];\n const { chapter, onTime } = useChapter(current);\n const bounds = typeof autoplay === \"object\" ? autoplay : {};\n const wraps = Boolean(autoplay) && total > 1;\n const ownClips = !renderLoop && slides.some((slide) => slide.video);\n const moving = !calm && (wraps || ownClips);\n const held = holds === \"pointer-focus\" && (hovered || keyboardIn);\n const advancing = wraps && !calm && !paused && !held && onScreen && !hidden;\n const clipPlaying = onScreen && !paused && !hidden;\n const hasAudio = Boolean(sound) && !calm && ownClips && slides.some((slide) => slide.audio && slide.video);\n const audible = hasAudio && soundChosen && Boolean(current?.audio) && (hovered || focusIn);\n\n const show = (to: number) => {\n setActive(to);\n setSeen((before) => new Set(before).add(to));\n onSlideChange?.(to);\n };\n const turn = (delta: number) => {\n const to = wraps ? (active + delta + total) % total : clamp(active + delta, 0, total - 1);\n if (to === active) return;\n show(to);\n if (!wraps) keepFocus(toolbar.current, to, total);\n };\n const swipe = useSwipe(turn);\n const keys = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const moves: Partial<Record<string, () => void>> = {\n ArrowRight: () => turn(1),\n ArrowLeft: () => turn(-1),\n Home: () => turn(-active),\n End: () => turn(total - 1 - active),\n };\n const move = moves[event.key];\n if (!move) return;\n event.preventDefault();\n move();\n };\n const name = (i: number) => labels.slide.replace(\"{n}\", String(i + 1)).replace(\"{total}\", String(total));\n const clipOf = (slide: CarouselSlide, i: number): React.ReactNode => {\n if (!slide.video) return null;\n if (renderLoop) return renderLoop(slide.video, { poster: slide.src, inView: i === active });\n if (i !== active || calm || !loaded || broken.has(slide.id)) return null;\n return (\n <SlideClip\n key={slide.id}\n video={slide.video}\n poster={slide.src}\n playing={clipPlaying}\n muted={!audible}\n onTime={onTime}\n onBroken={() => setBroken((before) => new Set(before).add(slide.id))}\n />\n );\n };\n const dwell = current ? carouselDwell(current, bounds) : 0;\n const barCaption = barCaptionOf(caption, current, chapter);\n const showBar = total > 1 || moving || Boolean(barCaption);\n\n return (\n <section\n ref={root}\n aria-roledescription={labels.carousel}\n aria-label={label}\n data-frame={frame}\n data-advancing={advancing ? \"\" : undefined}\n className={s.root({ className })}\n {...handlers}\n {...props}\n >\n {wraps && (\n <style href=\"kz-media-carousel\" precedence=\"medium\">\n {CLOCK_CSS}\n </style>\n )}\n <div className={s.stage()} style={{ aspectRatio: ratio }}>\n <ul className={s.track()} {...swipe}>\n {slides.map((slide, i) => {\n const here = i === active;\n return (\n <li\n key={slide.id}\n aria-roledescription={labels.slideRole}\n aria-label={name(i)}\n data-kind={slide.kind ?? (slide.video ? \"clip\" : \"still\")}\n data-active={here ? \"\" : undefined}\n className={s.slide()}\n style={{ aspectRatio: ratio }}\n aria-hidden={here ? undefined : true}\n inert={here ? undefined : true}\n >\n <figure className=\"m-0 h-full w-full\">\n <SlideMedia\n slide={slide}\n first={i === 0}\n drawn={seen.has(i) || i === (active + 1) % total}\n clip={clipOf(slide, i)}\n ratio={ratio}\n closeLabel={labels.close}\n overlay={caption === \"overlay\"}\n playerLabels={playerLabels}\n />\n </figure>\n </li>\n );\n })}\n </ul>\n {wraps && <CarouselTicks slides={slides} active={active} calm={calm} dwell={dwell} advancing={advancing} onEnd={() => turn(1)} s={s} />}\n </div>\n {showBar && (\n <div className={s.bar()}>\n <p className={s.barCaption()} aria-live={advancing ? \"off\" : \"polite\"}>\n {total > 1 && (\n <span className={s.count()}>\n {active + 1} / {total}\n </span>\n )}\n {barCaption && <> {barCaption}</>}\n </p>\n <CarouselToolbar\n ref={toolbar}\n labels={labels}\n turns={total > 1}\n atStart={!wraps && active === 0}\n atEnd={!wraps && active === total - 1}\n moving={moving}\n paused={paused}\n onPause={() => setPaused((p) => !p)}\n sound={{ shown: hasAudio, on: soundChosen, toggle: toggleSound }}\n onTurn={turn}\n onKeyDown={keys}\n className={s.buttons()}\n />\n </div>\n )}\n {textVersion ? (\n <TextVersion slides={slides} summary={labels.textVersion} className={s.text()}>\n {children}\n </TextVersion>\n ) : (\n children\n )}\n </section>\n );\n}\n"
|
|
202
|
+
"content": "// Client (the slide in view, the clock, the reader's motion, data and sound choices). Carousel v2 (ADR-010): a sequence of\n// clips, screen demos and stills given as data, one at a time in one frame. The slides cross-fade in place (nothing\n// travels); previous / next sit in a toolbar that also takes ← → Home End, a swipe turns one slide, a « n / N » count.\n// With `autoplay` it advances by itself at the media's pace — the clock IS the CSS animation of the current progress\n// tick, so holding it (the pause button, the pointer, the keyboard focus, a hidden tab, off screen) keeps it where it\n// stood. Under reduced motion or Save-Data nothing advances and no clip is mounted: the posters and the buttons.\n// Posters first, one clip (the slide in view) after the page's `load`; a clip that cannot play leaves its poster. Sound is\n// an option: after a press on « Sound on », hovering or focusing the carousel plays the slide's audio.\nimport * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { IconButton } from \"../button/button\";\nimport { ChevronGlyph, PauseGlyph, PlayGlyph, VolumeGlyph } from \"../glyphs\";\nimport { clamp, playSafely, useCalm, useInView, usePageHidden, usePageLoaded } from \"../media\";\nimport { MediaPlayer, type MediaPlayerProps } from \"./media-player\";\n\nexport const mediaCarousel = tv({\n slots: {\n root: \"relative isolate w-full min-w-0\",\n stage: \"relative isolate w-full overflow-hidden bg-media\",\n track: \"m-0 grid list-none p-0 touch-pan-y\",\n slide: \"relative col-start-1 row-start-1 m-0 w-full overflow-hidden opacity-0 transition-opacity duration-500 motion-reduce:transition-none data-[active]:opacity-100\",\n media: \"absolute inset-0 h-full w-full object-cover\",\n caption: \"absolute inset-x-0 bottom-0 bg-linear-to-t from-scrim-strong to-transparent p-3 pt-8 text-xs font-semibold text-fg-on-media\",\n ticks: \"pointer-events-none absolute inset-x-3 bottom-2.5 z-10 flex gap-1.5\",\n tick: \"relative h-0.5 flex-1 overflow-hidden bg-fg-on-media/30 data-[state=done]:bg-fg-on-media data-[state=full]:bg-[var(--kz-hue,var(--kz-accent))]\",\n fill: \"kz-media-carousel-fill absolute inset-0 bg-[var(--kz-hue,var(--kz-accent))]\",\n mark: \"absolute top-0 h-full w-px bg-media\",\n bar: \"mt-3 flex items-start justify-between gap-3\",\n barCaption: \"m-0 min-w-0 font-mono text-[13px] leading-[19px] text-fg-secondary [overflow-wrap:anywhere]\",\n count: \"text-xs tabular-nums text-fg-secondary\",\n buttons: \"flex flex-none gap-2\",\n text: \"mt-2.5 text-sm text-fg-secondary [&_li]:my-1\",\n },\n variants: {\n frame: {\n product: { stage: \"rounded-xl border border-border-default\" },\n cahier: { stage: \"rounded-none border border-border-strong shadow-[4px_4px_0_var(--kz-border-strong)]\", count: \"mr-2.5 font-mono text-fg-primary\" },\n },\n },\n defaultVariants: { frame: \"product\" },\n});\n\n/** What a slide is: a clip (a short generated or filmed shot), a screen demo (a product journey, often with chapters), a still. */\nexport type CarouselSlideKind = \"clip\" | \"screen-demo\" | \"still\";\n/** A step of a screen demo: where it starts, in seconds, and its name. */\nexport type CarouselChapter = { at: number; label: string };\n\nexport type CarouselSlide = {\n /** A stable id. */\n id: string;\n /** What it is. Default: `clip` with a `video`, `still` without. */\n kind?: CarouselSlideKind;\n /** The poster of a clip or a film, or the still: 16:9, drawn first. */\n src: string;\n /** What it shows, in words. */\n alt: string;\n /** « Fig. 1a — … »: over the foot of the slide, or in the bar with `caption=\"bar\"`. */\n caption?: string;\n /** The slide's line in the text version; `alt` when absent. */\n text?: string;\n /** The clip: one rendition, two encodes (VP9 `webm` first, H.264 `mp4` for Safari). Muted; plays while the slide is in view, on screen, after the page's `load`; never under reduced motion or Save-Data. */\n video?: { webm?: string; mp4?: string };\n /** The clip's length in seconds, as measured on the file (`krizaka-media-guard` reports it): with `autoplay`, the slide's time on screen. */\n duration?: number;\n /** The clip's file has an audio track (the guard checks it says the truth): « Sound on » can then play it. */\n audio?: boolean;\n /** A screen demo's steps: marks on the progress tick, the caption follows the step under the playhead, listed in the text version. */\n chapters?: readonly CarouselChapter[];\n /** A film opened by a press, with sound, in the lightbox of the MediaPlayer. */\n film?: Pick<MediaPlayerProps, \"src\" | \"title\" | \"tracks\" | \"loadHls\" | \"labels\" | \"ratio\"> & { playLabel: string; vertical?: boolean };\n};\n\nexport type MediaCarouselLabels = {\n previous: string;\n next: string;\n close: string;\n /** A slide's name, with `{n}` and `{total}`. */\n slide: string;\n /** The pause button while something moves. */\n pause: string;\n /** The same button once paused. */\n play: string;\n /** The sound toggle (pressed or not). */\n soundOn: string;\n /** The summary of the text version. */\n textVersion: string;\n /** The carousel's role description (`aria-roledescription`). */\n carousel: string;\n /** A slide's role description. */\n slideRole: string;\n};\nexport const mediaCarouselLabels: MediaCarouselLabels = {\n previous: \"Previous\",\n next: \"Next\",\n close: \"Close\",\n slide: \"{n} of {total}\",\n pause: \"Pause the carousel\",\n play: \"Play the carousel\",\n soundOn: \"Sound on\",\n textVersion: \"Text version\",\n carousel: \"carousel\",\n slideRole: \"slide\",\n};\n\n/** The bounds of a slide's time on screen, in seconds. */\nexport type CarouselAutoplay = { minDwell?: number; maxDwell?: number };\n\n// @fixed: the shortest time a slide stays, in seconds: reading a caption (ADR-010 §3), not a setting.\nexport const CAROUSEL_MIN_DWELL = 5;\n// @fixed: the longest, in seconds: the longest screen journey of a product demo (krizaka-internal#2655).\nexport const CAROUSEL_MAX_DWELL = 45;\n// @fixed: a still (or a clip of unknown length) stays a reading time and a breath, in seconds.\nconst STILL_EXTRA = 1.5;\n\n/** How long a slide stays with `autoplay`, in milliseconds: its media's duration within the bounds, or a reading time for a still. */\nexport function carouselDwell(slide: Pick<CarouselSlide, \"duration\" | \"video\">, bounds: CarouselAutoplay = {}): number {\n const min = bounds.minDwell ?? CAROUSEL_MIN_DWELL;\n const max = Math.max(min, bounds.maxDwell ?? CAROUSEL_MAX_DWELL);\n const seconds = slide.video && slide.duration && slide.duration > 0 ? clamp(slide.duration, min, max) : clamp(min + STILL_EXTRA, min, max);\n return Math.round(seconds * 1000);\n}\n\n/** The chapter under the playhead: the last one that has started. */\nexport function chapterAt(chapters: readonly CarouselChapter[] | undefined, seconds: number): number {\n if (!chapters?.length) return -1;\n let found = -1;\n chapters.forEach((c, i) => {\n if (seconds >= c.at) found = i;\n });\n return found;\n}\n\nexport type MediaCarouselProps = Omit<React.ComponentProps<\"section\">, \"children\"> & {\n /** The slides, in order. */\n slides: readonly CarouselSlide[];\n /** The carousel's accessible name, passed translated. */\n label: string;\n /** The frame ratio of every slide (width / height). Default `16 / 9`, the house ratio. */\n ratio?: string;\n /** Advances by itself (wrapping), each slide for its `duration` within the bounds (`true`: 5–45 s). Never under reduced motion or Save-Data; held by the pause button, a hidden tab, off screen (and, with `holds=\"pointer-focus\"`, the pointer and a keyboard focus). */\n autoplay?: boolean | CarouselAutoplay;\n /** What holds the autoplay clock besides the visible pause, a hidden tab, off screen, reduced motion and Save-Data. `pause-only` (default, WCAG 2.2.2): nothing else, so a resting pointer or a click on next never freezes it. `pointer-focus`: the pointer (not a touch) and a keyboard focus inside hold it too. */\n holds?: \"pause-only\" | \"pointer-focus\";\n /** Offers « Sound on » when a slide declares `audio`: after the press, hovering or focusing the carousel plays that slide's sound. Never without the press. */\n sound?: boolean;\n /** `product` (default): the product register's rounded frame. `cahier`: the company's sites — square, a solid paper shadow, the count in the typewriter face. */\n frame?: \"product\" | \"cahier\";\n /** Where a slide's caption sits: over its foot (`overlay`, default) or in the bar under the frame (`bar`). */\n caption?: \"overlay\" | \"bar\";\n /** Renders the text version under the carousel: every slide's caption and text (and chapters), in a native `<details>`. */\n textVersion?: boolean;\n /** Rendered inside the text version (the host's sources, a link to the film); after the carousel without one. */\n children?: React.ReactNode;\n /** The words, passed translated; English by default. `slide` takes `{n}` and `{total}`. */\n labels?: Partial<MediaCarouselLabels>;\n /** The words of the lightbox player of every film (speed, captions, time…), passed translated; a slide's own `film.labels` wins. */\n playerLabels?: MediaPlayerProps[\"labels\"];\n /** Called with the index of the slide in view when it changes. */\n onSlideChange?: (index: number) => void;\n /**\n * Draws a slide's `video` in place of the carousel's own clip.\n * @deprecated Since carousel v2 (ADR-010) the carousel draws its clips itself, with its pause in the toolbar. Removed in 4.0.\n */\n renderLoop?: (video: NonNullable<CarouselSlide[\"video\"]>, context: { poster: string; inView: boolean }) => React.ReactNode;\n};\n\nconst CLOCK_CSS =\n \".kz-media-carousel-fill{transform-origin:left;transform:scaleX(0);animation-name:kz-media-carousel-fill;animation-timing-function:linear;animation-fill-mode:forwards}\" +\n \"@keyframes kz-media-carousel-fill{from{transform:scaleX(0)}to{transform:scaleX(1)}}\";\n\n/** How far a swipe travels, in CSS pixels, before it turns the slide. */\nconst SWIPE_DISTANCE = 40;\nconst SOUND_KEY = \"kz-media-carousel-sound\";\nconst SOUND_EVENT = \"kz-media-carousel-sound\";\n\n/** A horizontal swipe turns one slide; a vertical one stays the page's scroll (`touch-action: pan-y`). */\nfunction useSwipe(turn: (delta: 1 | -1) => void) {\n const from = React.useRef<number | null>(null);\n return {\n onPointerDown: (event: React.PointerEvent) => {\n from.current = event.clientX;\n },\n onPointerUp: (event: React.PointerEvent) => {\n const start = from.current;\n from.current = null;\n if (start === null) return;\n const distance = event.clientX - start;\n if (Math.abs(distance) >= SWIPE_DISTANCE) turn(distance < 0 ? 1 : -1);\n },\n onPointerCancel: () => {\n from.current = null;\n },\n };\n}\n\nconst subscribeSound = (notify: () => void) => {\n globalThis.addEventListener(SOUND_EVENT, notify);\n return () => globalThis.removeEventListener(SOUND_EVENT, notify);\n};\nconst readSound = () => {\n try {\n return globalThis.sessionStorage.getItem(SOUND_KEY) === \"1\";\n } catch {\n return false;\n }\n};\n/** The visitor's choice of sound, for this session (off on the server and before any press). */\nfunction useSoundChoice(): [boolean, () => void] {\n const on = React.useSyncExternalStore(subscribeSound, readSound, () => false);\n const toggle = () => {\n try {\n globalThis.sessionStorage.setItem(SOUND_KEY, on ? \"0\" : \"1\");\n } catch {\n // No storage (a private window): the choice holds until the next render only.\n }\n globalThis.dispatchEvent(new Event(SOUND_EVENT));\n };\n return [on, toggle];\n}\n\n/** The keyboard put the focus there (`:focus-visible`): only then does a focus hold the clock; a click does not. */\nfunction keyboardFocus(target: EventTarget | null): boolean {\n try {\n return target instanceof Element && target.matches(\":focus-visible\");\n } catch {\n return true;\n }\n}\n\n/** At an end the button just used is disabled: the focus moves to the other one, never to the page. */\nfunction keepFocus(toolbar: HTMLElement | null, at: number, count: number) {\n if (!toolbar?.contains(document.activeElement)) return;\n const buttons = toolbar.querySelectorAll(\"button\");\n const previous = buttons[0];\n const next = buttons[buttons.length - 1];\n if (at === 0) next?.focus();\n if (at === count - 1) previous?.focus();\n}\n\ntype ClipProps = Readonly<{\n video: NonNullable<CarouselSlide[\"video\"]>;\n poster: string;\n playing: boolean;\n muted: boolean;\n onBroken: () => void;\n onTime?: (seconds: number) => void;\n}>;\n\n/** The slide's clip: muted until the sound is chosen, looping while its slide stays (never a held last frame), gone if no source plays. */\nfunction SlideClip({ video, poster, playing, muted, onBroken, onTime }: Readonly<ClipProps>) {\n const ref = React.useRef<HTMLVideoElement>(null);\n React.useEffect(() => {\n if (ref.current) ref.current.muted = muted;\n }, [muted]);\n React.useEffect(() => {\n if (!ref.current) return;\n if (playing) playSafely(ref.current);\n else ref.current.pause?.();\n }, [playing]);\n const last = video.mp4 ? \"mp4\" : \"webm\";\n return (\n <video\n ref={ref}\n className={mediaCarousel().media()}\n poster={poster}\n muted\n loop\n playsInline\n preload=\"auto\"\n aria-hidden\n tabIndex={-1}\n onTimeUpdate={onTime ? (e) => onTime(e.currentTarget.currentTime) : undefined}\n >\n {video.webm && <source src={video.webm} type=\"video/webm\" onError={last === \"webm\" ? onBroken : undefined} />}\n {video.mp4 && <source src={video.mp4} type=\"video/mp4\" onError={onBroken} />}\n </video>\n );\n}\n\ntype SlideMediaProps = Readonly<{ slide: CarouselSlide; first: boolean; drawn: boolean; clip: React.ReactNode; ratio: string; closeLabel: string; overlay: boolean; playerLabels?: MediaPlayerProps[\"labels\"] }>;\n\n/** A poster that opens its film, or a still; its clip plays over it while the slide is the one in view. */\nfunction SlideMedia({ slide, first, drawn, clip, ratio, closeLabel, overlay, playerLabels }: Readonly<SlideMediaProps>) {\n const s = mediaCarousel();\n if (slide.film) {\n return (\n <MediaPlayer\n {...slide.film}\n labels={slide.film.labels ?? playerLabels}\n mode=\"lightbox\"\n poster={slide.src}\n posterAlt={slide.alt}\n caption={overlay ? slide.caption : undefined}\n closeLabel={closeLabel}\n preview={clip}\n className=\"h-full rounded-none border-0\"\n />\n );\n }\n return (\n <>\n {drawn && <img src={slide.src} alt={slide.alt} loading={first ? undefined : \"lazy\"} decoding=\"async\" draggable={false} className={s.media()} style={{ aspectRatio: ratio }} />}\n {clip}\n {overlay && slide.caption && <figcaption className={s.caption()}>{slide.caption}</figcaption>}\n </>\n );\n}\n\n/** A tick's state: before the current one, the current one (filling, or full when nothing advances), still to come. */\nfunction tickState(i: number, active: number, filling: boolean): \"done\" | \"now\" | \"full\" | undefined {\n if (i < active) return \"done\";\n if (i !== active) return undefined;\n return filling ? \"now\" : \"full\";\n}\n\n/** A screen demo's steps, as marks on its progress tick (where each starts, over the clip's length). */\nfunction ChapterMarks({ slide, className }: Readonly<{ slide: CarouselSlide; className: string }>) {\n const length = slide.duration ?? 0;\n if (!slide.chapters?.length || length <= 0) return null;\n return slide.chapters.map((c) => <i key={c.at} className={className} style={{ left: `${(c.at / length) * 100}%` }} />);\n}\n\n/** The step of the current slide under the playhead, followed only for a slide with chapters. */\nfunction useChapter(slide: CarouselSlide | undefined) {\n const [chapter, setChapter] = React.useState(-1);\n const [shown, setShown] = React.useState(slide?.id);\n if (shown !== slide?.id) {\n setShown(slide?.id);\n setChapter(-1);\n }\n const onTime = slide?.chapters?.length ? (seconds: number) => setChapter(chapterAt(slide.chapters, seconds)) : undefined;\n return { chapter: slide?.chapters?.[chapter], onTime };\n}\n\n/** What holds the clock and what lets the sound play: the pointer (not a touch), any focus inside, a keyboard focus inside. */\nfunction useHolds() {\n const [hovered, setHovered] = React.useState(false);\n const [focusIn, setFocusIn] = React.useState(false);\n const [keyboardIn, setKeyboardIn] = React.useState(false);\n const handlers = {\n onPointerEnter: (e: React.PointerEvent) => setHovered(e.pointerType !== \"touch\"),\n onPointerLeave: () => setHovered(false),\n onFocus: (e: React.FocusEvent) => {\n setFocusIn(true);\n setKeyboardIn(keyboardFocus(e.target));\n },\n onBlur: (e: React.FocusEvent) => {\n if (e.currentTarget.contains(e.relatedTarget as Node | null)) return;\n setFocusIn(false);\n setKeyboardIn(false);\n },\n };\n return { hovered, focusIn, keyboardIn, handlers };\n}\n\ntype TicksProps = Readonly<{ slides: readonly CarouselSlide[]; active: number; calm: boolean; dwell: number; advancing: boolean; onEnd: () => void; s: ReturnType<typeof mediaCarousel> }>;\n\n/** One hairline per slide; the current one fills over its dwell — the clock — and holds with the carousel. */\nfunction CarouselTicks({ slides, active, calm, dwell, advancing, onEnd, s }: Readonly<TicksProps>) {\n return (\n <div className={s.ticks()} aria-hidden>\n {slides.map((slide, i) => (\n <span key={slide.id} className={s.tick()} data-state={tickState(i, active, !calm)}>\n {i === active && !calm && (\n <span\n key={`${active}`}\n className={s.fill()}\n style={{ animationDuration: `${dwell}ms`, animationPlayState: advancing ? \"running\" : \"paused\" }}\n onAnimationEnd={() => advancing && onEnd()}\n />\n )}\n {i === active && <ChapterMarks slide={slide} className={s.mark()} />}\n </span>\n ))}\n </div>\n );\n}\n\ntype ToolbarProps = Readonly<{\n labels: MediaCarouselLabels;\n turns: boolean;\n atStart: boolean;\n atEnd: boolean;\n moving: boolean;\n paused: boolean;\n onPause: () => void;\n sound: { shown: boolean; on: boolean; toggle: () => void };\n onTurn: (delta: number) => void;\n onKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => void;\n className: string;\n}>;\n\n/** Previous, pause / play, « Sound on », next: one toolbar that also takes ← → Home End. */\nconst CarouselToolbar = React.forwardRef<HTMLDivElement, ToolbarProps>(function CarouselToolbar(\n { labels, turns, atStart, atEnd, moving, paused, onPause, sound, onTurn, onKeyDown, className },\n ref,\n) {\n return (\n <div ref={ref} role=\"toolbar\" aria-orientation=\"horizontal\" className={className} onKeyDown={onKeyDown}>\n {turns && (\n <IconButton variant=\"secondary\" label={labels.previous} disabled={atStart} onClick={() => onTurn(-1)}>\n <ChevronGlyph direction=\"left\" className=\"h-5 w-5\" />\n </IconButton>\n )}\n {moving && (\n <IconButton variant=\"secondary\" label={paused ? labels.play : labels.pause} aria-pressed={paused} onClick={onPause}>\n {paused ? <PlayGlyph className=\"h-4 w-4\" /> : <PauseGlyph className=\"h-4 w-4\" />}\n </IconButton>\n )}\n {sound.shown && (\n <IconButton variant=\"secondary\" label={labels.soundOn} aria-pressed={sound.on} onClick={sound.toggle}>\n <VolumeGlyph muted={!sound.on} className=\"h-4 w-4\" />\n </IconButton>\n )}\n {turns && (\n <IconButton variant=\"secondary\" label={labels.next} disabled={atEnd} onClick={() => onTurn(1)}>\n <ChevronGlyph direction=\"right\" className=\"h-5 w-5\" />\n </IconButton>\n )}\n </div>\n );\n});\n\n/** Every slide's caption and text, and a screen demo's chapters, in a native `<details>`; the host's `children` inside. */\nfunction TextVersion({ slides, summary, className, children }: Readonly<{ slides: readonly CarouselSlide[]; summary: string; className: string; children?: React.ReactNode }>) {\n return (\n <details className={className}>\n <summary>{summary}</summary>\n <ol>\n {slides.map((slide) => (\n <li key={slide.id}>\n {slide.caption && <b>{slide.caption}</b>} {slide.text ?? slide.alt}\n {slide.chapters?.length ? (\n <ol>\n {slide.chapters.map((c) => (\n <li key={c.at}>{c.label}</li>\n ))}\n </ol>\n ) : null}\n </li>\n ))}\n </ol>\n {children}\n </details>\n );\n}\n\n/** The caption shown in the bar: the slide's, with the chapter under the playhead. */\nfunction barCaptionOf(placement: \"overlay\" | \"bar\", slide: CarouselSlide | undefined, chapter: CarouselChapter | undefined) {\n if (placement !== \"bar\" || !slide?.caption) return undefined;\n return chapter ? [slide.caption, chapter.label].join(\" · \") : slide.caption;\n}\n\n/** A sequence of clips, screen demos and stills, one at a time: buttons, arrow keys, swipe, and with `autoplay` it advances at the media's pace. */\nexport function MediaCarousel({\n slides,\n label,\n ratio = \"16 / 9\",\n autoplay,\n holds = \"pause-only\",\n sound,\n frame = \"product\",\n caption = \"overlay\",\n textVersion,\n children,\n labels: given,\n playerLabels,\n onSlideChange,\n renderLoop,\n className,\n ...props\n}: Readonly<MediaCarouselProps>) {\n const labels = { ...mediaCarouselLabels, ...given };\n const s = mediaCarousel({ frame });\n const total = slides.length;\n const root = React.useRef<HTMLElement>(null);\n const toolbar = React.useRef<HTMLDivElement>(null);\n const calm = useCalm();\n const loaded = usePageLoaded();\n const hidden = usePageHidden();\n const [soundChosen, toggleSound] = useSoundChoice();\n const [active, setActive] = React.useState(0);\n const [seen, setSeen] = React.useState<ReadonlySet<number>>(() => new Set([0]));\n const [broken, setBroken] = React.useState<ReadonlySet<string>>(() => new Set());\n const [paused, setPaused] = React.useState(false);\n const { hovered, focusIn, keyboardIn, handlers } = useHolds();\n const [onScreen, setOnScreen] = React.useState(() => typeof IntersectionObserver === \"undefined\");\n useInView(root, setOnScreen);\n\n const current = slides[active];\n const { chapter, onTime } = useChapter(current);\n const bounds = typeof autoplay === \"object\" ? autoplay : {};\n const wraps = Boolean(autoplay) && total > 1;\n const ownClips = !renderLoop && slides.some((slide) => slide.video);\n const moving = !calm && (wraps || ownClips);\n const held = holds === \"pointer-focus\" && (hovered || keyboardIn);\n const advancing = wraps && !calm && !paused && !held && onScreen && !hidden;\n const clipPlaying = onScreen && !paused && !hidden;\n const hasAudio = Boolean(sound) && !calm && ownClips && slides.some((slide) => slide.audio && slide.video);\n const audible = hasAudio && soundChosen && Boolean(current?.audio) && (hovered || focusIn);\n\n const show = (to: number) => {\n setActive(to);\n setSeen((before) => new Set(before).add(to));\n onSlideChange?.(to);\n };\n const turn = (delta: number) => {\n const to = wraps ? (active + delta + total) % total : clamp(active + delta, 0, total - 1);\n if (to === active) return;\n show(to);\n if (!wraps) keepFocus(toolbar.current, to, total);\n };\n const swipe = useSwipe(turn);\n const keys = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const moves: Partial<Record<string, () => void>> = {\n ArrowRight: () => turn(1),\n ArrowLeft: () => turn(-1),\n Home: () => turn(-active),\n End: () => turn(total - 1 - active),\n };\n const move = moves[event.key];\n if (!move) return;\n event.preventDefault();\n move();\n };\n const name = (i: number) => labels.slide.replace(\"{n}\", String(i + 1)).replace(\"{total}\", String(total));\n const clipOf = (slide: CarouselSlide, i: number): React.ReactNode => {\n if (!slide.video) return null;\n if (renderLoop) return renderLoop(slide.video, { poster: slide.src, inView: i === active });\n if (i !== active || calm || !loaded || broken.has(slide.id)) return null;\n return (\n <SlideClip\n key={slide.id}\n video={slide.video}\n poster={slide.src}\n playing={clipPlaying}\n muted={!audible}\n onTime={onTime}\n onBroken={() => setBroken((before) => new Set(before).add(slide.id))}\n />\n );\n };\n const dwell = current ? carouselDwell(current, bounds) : 0;\n const barCaption = barCaptionOf(caption, current, chapter);\n const showBar = total > 1 || moving || Boolean(barCaption);\n\n return (\n <section\n ref={root}\n aria-roledescription={labels.carousel}\n aria-label={label}\n data-frame={frame}\n data-advancing={advancing ? \"\" : undefined}\n className={s.root({ className })}\n {...handlers}\n {...props}\n >\n {wraps && (\n <style href=\"kz-media-carousel\" precedence=\"medium\">\n {CLOCK_CSS}\n </style>\n )}\n <div className={s.stage()} style={{ aspectRatio: ratio }}>\n <ul className={s.track()} {...swipe}>\n {slides.map((slide, i) => {\n const here = i === active;\n return (\n <li\n key={slide.id}\n aria-roledescription={labels.slideRole}\n aria-label={name(i)}\n data-kind={slide.kind ?? (slide.video ? \"clip\" : \"still\")}\n data-active={here ? \"\" : undefined}\n className={s.slide()}\n style={{ aspectRatio: ratio }}\n aria-hidden={here ? undefined : true}\n inert={here ? undefined : true}\n >\n <figure className=\"m-0 h-full w-full\">\n <SlideMedia\n slide={slide}\n first={i === 0}\n drawn={seen.has(i) || i === (active + 1) % total}\n clip={clipOf(slide, i)}\n ratio={ratio}\n closeLabel={labels.close}\n overlay={caption === \"overlay\"}\n playerLabels={playerLabels}\n />\n </figure>\n </li>\n );\n })}\n </ul>\n {wraps && <CarouselTicks slides={slides} active={active} calm={calm} dwell={dwell} advancing={advancing} onEnd={() => turn(1)} s={s} />}\n </div>\n {showBar && (\n <div className={s.bar()}>\n <p className={s.barCaption()} aria-live={advancing ? \"off\" : \"polite\"}>\n {total > 1 && (\n <span className={s.count()}>\n {active + 1} / {total}\n </span>\n )}\n {barCaption && <> {barCaption}</>}\n </p>\n <CarouselToolbar\n ref={toolbar}\n labels={labels}\n turns={total > 1}\n atStart={!wraps && active === 0}\n atEnd={!wraps && active === total - 1}\n moving={moving}\n paused={paused}\n onPause={() => setPaused((p) => !p)}\n sound={{ shown: hasAudio, on: soundChosen, toggle: toggleSound }}\n onTurn={turn}\n onKeyDown={keys}\n className={s.buttons()}\n />\n </div>\n )}\n {textVersion ? (\n <TextVersion slides={slides} summary={labels.textVersion} className={s.text()}>\n {children}\n </TextVersion>\n ) : (\n children\n )}\n </section>\n );\n}\n"
|
|
203
203
|
},
|
|
204
204
|
{
|
|
205
205
|
"path": "media-gallery/media-gallery.tsx",
|
|
206
|
-
"content": "// Client (the reader's motion preference). A shop's photos and loops in tiles: the first is the featured one, loops play\n// muted while their tile is on screen (a still under reduced motion), a caption rides the foot of a tile.\nimport * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nexport const mediaGallery = tv({\n slots: {\n root: \"m-0 grid list-none grid-cols-2 gap-2 p-0 sm:gap-3 md:grid-cols-4\",\n tile:\n \"group relative isolate m-0 aspect-[3/4] overflow-hidden rounded-xl border border-border-default bg-media data-[shape=wide]:aspect-[4/3] \" +\n // The featured tile takes two columns; from md up it has no ratio of its own and stretches to the height of the row its neighbours set.\n \"data-[featured]:col-span-2 data-[featured]:aspect-[4/3] md:data-[featured]:aspect-auto\",\n media: \"absolute inset-0 h-full w-full object-cover\",\n caption: \"pointer-events-none absolute inset-x-0 bottom-0 bg-linear-to-t from-scrim-strong to-transparent p-3 pt-8 text-xs font-semibold text-fg-on-media\",\n },\n});\nconst s = mediaGallery();\n\nexport type GalleryMedia = {\n /** A stable id. */\n id: string;\n /** The still: a photo, or the poster of a loop. */\n src: string;\n /** What it shows, in words. */\n alt: string;\n /** A muted loop: WebM first, MP4 for Safari. */\n video?: { webm?: string; mp4?: string };\n /** One line over the foot of the tile. */\n caption?: string;\n /** `wide` for a landscape source (4:3 tile); the default tile is a 3:4 portrait. */\n shape?: \"portrait\" | \"wide\";\n};\n\nexport type MediaGalleryProps = Omit<React.ComponentProps<\"ul\">, \"children\"> & {\n /** The photos and loops, the featured one first. */\n items: readonly GalleryMedia[];\n /** The gallery's accessible name, passed translated. */\n label: string;\n};\n\nfunction Tile({ item, featured }: { item: GalleryMedia; featured: boolean }) {\n const ref = React.useRef<HTMLLIElement>(null);\n const [play, setPlay] = React.useState(false);\n React.useEffect(() => {\n const node = ref.current;\n if (!item.video || !node ||
|
|
206
|
+
"content": "// Client (the reader's motion preference). A shop's photos and loops in tiles: the first is the featured one, loops play\n// muted while their tile is on screen (a still under reduced motion), a caption rides the foot of a tile.\nimport * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nexport const mediaGallery = tv({\n slots: {\n root: \"m-0 grid list-none grid-cols-2 gap-2 p-0 sm:gap-3 md:grid-cols-4\",\n tile:\n \"group relative isolate m-0 aspect-[3/4] overflow-hidden rounded-xl border border-border-default bg-media data-[shape=wide]:aspect-[4/3] \" +\n // The featured tile takes two columns; from md up it has no ratio of its own and stretches to the height of the row its neighbours set.\n \"data-[featured]:col-span-2 data-[featured]:aspect-[4/3] md:data-[featured]:aspect-auto\",\n media: \"absolute inset-0 h-full w-full object-cover\",\n caption: \"pointer-events-none absolute inset-x-0 bottom-0 bg-linear-to-t from-scrim-strong to-transparent p-3 pt-8 text-xs font-semibold text-fg-on-media\",\n },\n});\nconst s = mediaGallery();\n\nexport type GalleryMedia = {\n /** A stable id. */\n id: string;\n /** The still: a photo, or the poster of a loop. */\n src: string;\n /** What it shows, in words. */\n alt: string;\n /** A muted loop: WebM first, MP4 for Safari. */\n video?: { webm?: string; mp4?: string };\n /** One line over the foot of the tile. */\n caption?: string;\n /** `wide` for a landscape source (4:3 tile); the default tile is a 3:4 portrait. */\n shape?: \"portrait\" | \"wide\";\n};\n\nexport type MediaGalleryProps = Omit<React.ComponentProps<\"ul\">, \"children\"> & {\n /** The photos and loops, the featured one first. */\n items: readonly GalleryMedia[];\n /** The gallery's accessible name, passed translated. */\n label: string;\n};\n\nfunction Tile({ item, featured }: Readonly<{ item: GalleryMedia; featured: boolean }>) {\n const ref = React.useRef<HTMLLIElement>(null);\n const [play, setPlay] = React.useState(false);\n React.useEffect(() => {\n const node = ref.current;\n if (!item.video || !node || globalThis.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) return;\n const io = new IntersectionObserver(([entry]) => setPlay(Boolean(entry?.isIntersecting)), { rootMargin: \"120px\" });\n io.observe(node);\n return () => io.disconnect();\n }, [item.video]);\n return (\n <li ref={ref} className={s.tile()} data-featured={featured ? \"\" : undefined} data-shape={item.shape ?? \"portrait\"}>\n <figure className=\"m-0 h-full w-full\">\n <img src={item.src} alt={item.alt} loading=\"lazy\" decoding=\"async\" className={s.media()} />\n {play && item.video && (\n <video className={s.media()} poster={item.src} autoPlay muted loop playsInline preload=\"none\" aria-hidden tabIndex={-1}>\n {item.video.webm && <source src={item.video.webm} type=\"video/webm\" />}\n {item.video.mp4 && <source src={item.video.mp4} type=\"video/mp4\" />}\n </video>\n )}\n {item.caption && <figcaption className={s.caption()}>{item.caption}</figcaption>}\n </figure>\n </li>\n );\n}\n\n/** Photos and loops in tiles, the first featured; loops play while seen. */\nexport function MediaGallery({ items, label, className, ...props }: Readonly<MediaGalleryProps>) {\n return (\n <ul aria-label={label} className={s.root({ className })} {...props}>\n {items.map((item, i) => (\n <Tile key={item.id} item={item} featured={i === 0 && items.length > 2} />\n ))}\n </ul>\n );\n}\n"
|
|
207
207
|
},
|
|
208
208
|
{
|
|
209
209
|
"path": "media-gallery/media-player.tsx",
|
|
210
|
-
"content": "// Client (a dialog, the video player). ONE designed media player: the same frame inline, in a lightbox, or vertical (9:16).\n// Inline it is the VideoPlayer of `@krizaka/ui/video-player`; as a lightbox a poster with a play button opens the player in a\n// dialog, started by that press, with sound. Nothing moves under the pointer: the poster's hover is a colour.\nimport * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { PlayGlyph } from \"../glyphs\";\nimport { VideoPlayer, type VideoPlayerProps } from \"../video-player\";\n\n// The dialog and the player of the lightbox load when the poster is pressed, not with the page.\nconst PlayerLightbox = React.lazy(() => import(\"./player-lightbox\"));\n\nexport const mediaPlayer = tv({\n slots: {\n frame: \"relative block w-full overflow-hidden rounded-xl border border-border-default bg-media p-0 text-fg-on-media\",\n poster:\n \"group absolute inset-0 block h-full w-full \" +\n \"focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring\",\n image: \"absolute inset-0 h-full w-full object-cover\",\n play:\n \"absolute left-1/2 top-1/2 flex h-14 w-14 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full \" +\n \"bg-scrim-strong text-fg-on-media transition-colors group-hover:bg-scrim\",\n caption: \"pointer-events-none absolute inset-x-0 bottom-0 bg-linear-to-t from-scrim-strong to-transparent p-3 pt-8 text-left text-xs font-semibold\",\n },\n});\nconst s = mediaPlayer();\n\nexport type MediaPlayerProps = Pick<\n VideoPlayerProps,\n \"src\" | \"poster\" | \"title\" | \"tracks\" | \"loadHls\" | \"labels\" | \"onPlay\" | \"onPause\" | \"onEnded\" | \"onError\"\n> & {\n /** `inline`: the player itself. `lightbox`: a poster that opens it in a dialog. Default `inline`. */\n mode?: \"inline\" | \"lightbox\";\n /** `9 / 16` frame and the narrow dialog for a vertical film; default `16 / 9`. */\n vertical?: boolean;\n /** Any frame ratio (`19 / 16`, `4 / 3`): wins over the frame of `vertical` (give both for a portrait ratio: `vertical ratio=\"3 / 4\"`). Default `16 / 9` (`9 / 16` when `vertical`). */\n ratio?: string;\n /** The poster's words in the lightbox (\"Play the film\"), passed translated. Required for `lightbox`. */\n playLabel?: string;\n /** The close button's words, passed translated. Default `Close`. */\n closeLabel?: string;\n /** What the poster shows, in words (the `alt` of its image); default is empty (decorative: `playLabel` names the button). */\n posterAlt?: string;\n /** A line over the foot of the poster (« Fig. 1a »). */\n caption?: string;\n /** Lightbox: drawn over the poster, under its press (the frame is `relative`): a `<PausableLoop>` of `@krizaka/ui/pausable-loop` previews the film with a muted loop. */\n preview?: React.ReactNode;\n /** Lightbox: opens or closes it from outside (controlled). With it, `onOpenChange` is how the lightbox asks to close. */\n open?: boolean;\n /** Lightbox: replaces the poster with your own opener (`(open) => <button onClick={open}>…`); `null` draws nothing, for a lightbox driven by `open` alone. */\n trigger?: ((open: () => void) => React.ReactNode) | null;\n /** Called when the lightbox opens or closes. */\n onOpenChange?: (open: boolean) => void;\n /** Classes merged on the player or the poster. */\n className?: string;\n};\n\n/** A video in one frame: inline, in a lightbox (a press opens it with sound), 16:9 or vertical. */\nexport function MediaPlayer({\n mode = \"inline\",\n vertical = false,\n playLabel,\n closeLabel = \"Close\",\n posterAlt = \"\",\n caption,\n preview,\n open: given,\n trigger,\n onOpenChange,\n ratio: freeRatio,\n className,\n ...player\n}: MediaPlayerProps) {\n const ratio = freeRatio ?? (vertical ? \"9 / 16\" : \"16 / 9\");\n const [inner, setInner] = React.useState(false);\n const open = given ?? inner;\n const setOpen = (next: boolean) => {\n setInner(next);\n onOpenChange?.(next);\n };\n // The dialog hands the focus back to whatever opened it (the poster or the page's own trigger) when it closes.\n if (mode === \"inline\") return <VideoPlayer {...player} aspectRatio={ratio} className={className} />;\n const name = playLabel ?? player.title;\n // The default opener: the poster (and its loop) in a frame, one button named by `playLabel`; the pause is a sibling, never nested.\n const opener =\n trigger === undefined ? (\n <div className={s.frame({ className })} style={{ aspectRatio: ratio }}>\n {player.poster && <img src={player.poster} alt={posterAlt} loading=\"lazy\" decoding=\"async\" className={s.image()} />}\n {preview}\n <button type=\"button\" className={s.poster()} aria-label={caption ? `${caption}. ${name}` : name} onClick={() => setOpen(true)}>\n <span className={s.play()} aria-hidden>\n <PlayGlyph className=\"ml-1 h-6 w-6\" />\n </span>\n {caption && <span className={s.caption()}>{caption}</span>}\n </button>\n </div>\n ) : (\n trigger?.(() => setOpen(true))\n );\n return (\n <>\n {opener}\n {open && (\n <React.Suspense fallback={null}>\n <PlayerLightbox player={player} ratio={ratio} vertical={vertical} closeLabel={closeLabel} onClose={() => setOpen(false)} />\n </React.Suspense>\n )}\n </>\n );\n}\n"
|
|
210
|
+
"content": "// Client (a dialog, the video player). ONE designed media player: the same frame inline, in a lightbox, or vertical (9:16).\n// Inline it is the VideoPlayer of `@krizaka/ui/video-player`; as a lightbox a poster with a play button opens the player in a\n// dialog, started by that press, with sound. Nothing moves under the pointer: the poster's hover is a colour.\nimport * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { PlayGlyph } from \"../glyphs\";\nimport { VideoPlayer, type VideoPlayerProps } from \"../video-player\";\n\n// The dialog and the player of the lightbox load when the poster is pressed, not with the page.\nconst PlayerLightbox = React.lazy(() => import(\"./player-lightbox\"));\n\nexport const mediaPlayer = tv({\n slots: {\n frame: \"relative block w-full overflow-hidden rounded-xl border border-border-default bg-media p-0 text-fg-on-media\",\n poster:\n \"group absolute inset-0 block h-full w-full \" +\n \"focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring\",\n image: \"absolute inset-0 h-full w-full object-cover\",\n play:\n \"absolute left-1/2 top-1/2 flex h-14 w-14 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full \" +\n \"bg-scrim-strong text-fg-on-media transition-colors group-hover:bg-scrim\",\n caption: \"pointer-events-none absolute inset-x-0 bottom-0 bg-linear-to-t from-scrim-strong to-transparent p-3 pt-8 text-left text-xs font-semibold\",\n },\n});\nconst s = mediaPlayer();\n\nexport type MediaPlayerProps = Pick<\n VideoPlayerProps,\n \"src\" | \"poster\" | \"title\" | \"tracks\" | \"loadHls\" | \"labels\" | \"onPlay\" | \"onPause\" | \"onEnded\" | \"onError\"\n> & {\n /** `inline`: the player itself. `lightbox`: a poster that opens it in a dialog. Default `inline`. */\n mode?: \"inline\" | \"lightbox\";\n /** `9 / 16` frame and the narrow dialog for a vertical film; default `16 / 9`. */\n vertical?: boolean;\n /** Any frame ratio (`19 / 16`, `4 / 3`): wins over the frame of `vertical` (give both for a portrait ratio: `vertical ratio=\"3 / 4\"`). Default `16 / 9` (`9 / 16` when `vertical`). */\n ratio?: string;\n /** The poster's words in the lightbox (\"Play the film\"), passed translated. Required for `lightbox`. */\n playLabel?: string;\n /** The close button's words, passed translated. Default `Close`. */\n closeLabel?: string;\n /** What the poster shows, in words (the `alt` of its image); default is empty (decorative: `playLabel` names the button). */\n posterAlt?: string;\n /** A line over the foot of the poster (« Fig. 1a »). */\n caption?: string;\n /** Lightbox: drawn over the poster, under its press (the frame is `relative`): a `<PausableLoop>` of `@krizaka/ui/pausable-loop` previews the film with a muted loop. */\n preview?: React.ReactNode;\n /** Lightbox: opens or closes it from outside (controlled). With it, `onOpenChange` is how the lightbox asks to close. */\n open?: boolean;\n /** Lightbox: replaces the poster with your own opener (`(open) => <button onClick={open}>…`); `null` draws nothing, for a lightbox driven by `open` alone. */\n trigger?: ((open: () => void) => React.ReactNode) | null;\n /** Called when the lightbox opens or closes. */\n onOpenChange?: (open: boolean) => void;\n /** Classes merged on the player or the poster. */\n className?: string;\n};\n\n/** A video in one frame: inline, in a lightbox (a press opens it with sound), 16:9 or vertical. */\nexport function MediaPlayer({\n mode = \"inline\",\n vertical = false,\n playLabel,\n closeLabel = \"Close\",\n posterAlt = \"\",\n caption,\n preview,\n open: given,\n trigger,\n onOpenChange,\n ratio: freeRatio,\n className,\n ...player\n}: Readonly<MediaPlayerProps>) {\n const ratio = freeRatio ?? (vertical ? \"9 / 16\" : \"16 / 9\");\n const [inner, setInner] = React.useState(false);\n const open = given ?? inner;\n const setOpen = (next: boolean) => {\n setInner(next);\n onOpenChange?.(next);\n };\n // The dialog hands the focus back to whatever opened it (the poster or the page's own trigger) when it closes.\n if (mode === \"inline\") return <VideoPlayer {...player} aspectRatio={ratio} className={className} />;\n const name = playLabel ?? player.title;\n // The default opener: the poster (and its loop) in a frame, one button named by `playLabel`; the pause is a sibling, never nested.\n const opener =\n trigger === undefined ? (\n <div className={s.frame({ className })} style={{ aspectRatio: ratio }}>\n {player.poster && <img src={player.poster} alt={posterAlt} loading=\"lazy\" decoding=\"async\" className={s.image()} />}\n {preview}\n <button type=\"button\" className={s.poster()} aria-label={caption ? `${caption}. ${name}` : name} onClick={() => setOpen(true)}>\n <span className={s.play()} aria-hidden>\n <PlayGlyph className=\"ml-1 h-6 w-6\" />\n </span>\n {caption && <span className={s.caption()}>{caption}</span>}\n </button>\n </div>\n ) : (\n trigger?.(() => setOpen(true))\n );\n return (\n <>\n {opener}\n {open && (\n <React.Suspense fallback={null}>\n <PlayerLightbox player={player} ratio={ratio} vertical={vertical} closeLabel={closeLabel} onClose={() => setOpen(false)} />\n </React.Suspense>\n )}\n </>\n );\n}\n"
|
|
211
211
|
},
|
|
212
212
|
{
|
|
213
213
|
"path": "media-gallery/meta.ts",
|