@yaks/ui 0.0.0-stage → 0.2.36
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/Address.css +9 -0
- package/Address.js +32 -0
- package/Address.js.map +1 -0
- package/Address.ts +35 -0
- package/Annotated.css +17 -0
- package/Annotated.js +27 -0
- package/Annotated.js.map +1 -0
- package/Annotated.ts +32 -0
- package/AppShell.css +133 -0
- package/AppShell.js +90 -0
- package/AppShell.js.map +1 -0
- package/AppShell.ts +75 -0
- package/At.css +16 -0
- package/At.js +28 -0
- package/At.js.map +1 -0
- package/At.ts +37 -0
- package/Attachments.css +110 -0
- package/Attachments.js +119 -0
- package/Attachments.js.map +1 -0
- package/Attachments.ts +158 -0
- package/Badge.css +41 -0
- package/Badge.js +49 -0
- package/Badge.js.map +1 -0
- package/Badge.ts +38 -0
- package/Body.css +61 -0
- package/Body.js +103 -0
- package/Body.js.map +1 -0
- package/Body.ts +144 -0
- package/Button.css +121 -0
- package/Button.js +161 -0
- package/Button.js.map +1 -0
- package/Button.ts +92 -0
- package/Card.css +173 -0
- package/Card.js +165 -0
- package/Card.js.map +1 -0
- package/Card.ts +185 -0
- package/Cards.css +16 -0
- package/Cards.js +36 -0
- package/Cards.js.map +1 -0
- package/Cards.ts +64 -0
- package/Catalog.css +53 -0
- package/Catalog.js +55 -0
- package/Catalog.js.map +1 -0
- package/Catalog.ts +77 -0
- package/Chart.css +55 -0
- package/Chart.js +54 -0
- package/Chart.js.map +1 -0
- package/Chart.ts +62 -0
- package/Check.css +27 -0
- package/Check.js +77 -0
- package/Check.js.map +1 -0
- package/Check.ts +109 -0
- package/Chip.css +64 -0
- package/Chip.js +100 -0
- package/Chip.js.map +1 -0
- package/Chip.ts +66 -0
- package/Chips.css +10 -0
- package/Chips.js +41 -0
- package/Chips.js.map +1 -0
- package/Chips.ts +49 -0
- package/Choices.css +59 -0
- package/Choices.js +56 -0
- package/Choices.js.map +1 -0
- package/Choices.ts +73 -0
- package/Combobox.js +115 -0
- package/Combobox.js.map +1 -0
- package/Combobox.ts +230 -0
- package/Composer.css +247 -0
- package/Composer.js +222 -0
- package/Composer.js.map +1 -0
- package/Composer.ts +249 -0
- package/Contents.css +87 -0
- package/Contents.js +85 -0
- package/Contents.js.map +1 -0
- package/Contents.ts +117 -0
- package/Copy.css +28 -0
- package/Copy.js +62 -0
- package/Copy.js.map +1 -0
- package/Copy.ts +76 -0
- package/Doc.css +29 -0
- package/Doc.js +46 -0
- package/Doc.js.map +1 -0
- package/Doc.ts +64 -0
- package/Dock.css +157 -0
- package/Dock.js +229 -0
- package/Dock.js.map +1 -0
- package/Dock.ts +234 -0
- package/Dot.css +132 -0
- package/Dot.js +91 -0
- package/Dot.js.map +1 -0
- package/Dot.ts +72 -0
- package/Drop.css +133 -0
- package/Drop.js +148 -0
- package/Drop.js.map +1 -0
- package/Drop.ts +162 -0
- package/Edit.css +32 -0
- package/Edit.js +77 -0
- package/Edit.js.map +1 -0
- package/Edit.ts +72 -0
- package/Empty.css +32 -0
- package/Empty.js +45 -0
- package/Empty.js.map +1 -0
- package/Empty.ts +61 -0
- package/ErrorNotice.css +107 -0
- package/ErrorNotice.js +127 -0
- package/ErrorNotice.js.map +1 -0
- package/ErrorNotice.ts +133 -0
- package/Field.css +42 -0
- package/Field.js +186 -0
- package/Field.js.map +1 -0
- package/Field.ts +251 -0
- package/Form.css +95 -0
- package/Form.js +158 -0
- package/Form.js.map +1 -0
- package/Form.ts +212 -0
- package/Gallery.css +42 -0
- package/Gallery.js +57 -0
- package/Gallery.js.map +1 -0
- package/Gallery.ts +89 -0
- package/Group.css +8 -0
- package/Group.js +25 -0
- package/Group.js.map +1 -0
- package/Group.ts +40 -0
- package/Head.css +108 -0
- package/Head.js +124 -0
- package/Head.js.map +1 -0
- package/Head.ts +161 -0
- package/Icon.css +14 -0
- package/Icon.js +79 -0
- package/Icon.js.map +1 -0
- package/Icon.ts +78 -0
- package/IconButton.css +32 -0
- package/IconButton.js +74 -0
- package/IconButton.js.map +1 -0
- package/IconButton.ts +55 -0
- package/Id.css +29 -0
- package/Id.js +42 -0
- package/Id.js.map +1 -0
- package/Id.ts +31 -0
- package/Identity.css +122 -0
- package/Identity.js +88 -0
- package/Identity.js.map +1 -0
- package/Identity.ts +100 -0
- package/Index.css +68 -0
- package/Index.js +66 -0
- package/Index.js.map +1 -0
- package/Index.ts +63 -0
- package/LICENSE +202 -0
- package/Layer.css +82 -0
- package/Layer.js +86 -0
- package/Layer.js.map +1 -0
- package/Layer.ts +85 -0
- package/Lightbox.css +86 -0
- package/Lightbox.js +69 -0
- package/Lightbox.js.map +1 -0
- package/Lightbox.ts +79 -0
- package/Loading.css +22 -0
- package/Loading.js +75 -0
- package/Loading.js.map +1 -0
- package/Loading.ts +87 -0
- package/Logo.css +32 -0
- package/Logo.js +69 -0
- package/Logo.js.map +1 -0
- package/Logo.ts +81 -0
- package/Match.css +7 -0
- package/Match.js +51 -0
- package/Match.js.map +1 -0
- package/Match.ts +53 -0
- package/Menu.css +202 -0
- package/Menu.js +197 -0
- package/Menu.js.map +1 -0
- package/Menu.ts +233 -0
- package/Meter.css +49 -0
- package/Meter.js +149 -0
- package/Meter.js.map +1 -0
- package/Meter.ts +126 -0
- package/Metrics.css +43 -0
- package/Metrics.js +72 -0
- package/Metrics.js.map +1 -0
- package/Metrics.ts +66 -0
- package/Modal.css +94 -0
- package/Modal.js +114 -0
- package/Modal.js.map +1 -0
- package/Modal.ts +149 -0
- package/ModalDOM.css +23 -0
- package/More.css +135 -0
- package/More.js +135 -0
- package/More.js.map +1 -0
- package/More.ts +157 -0
- package/Notes.css +51 -0
- package/Notes.js +64 -0
- package/Notes.js.map +1 -0
- package/Notes.ts +95 -0
- package/Notice.css +30 -0
- package/Notice.js +50 -0
- package/Notice.js.map +1 -0
- package/Notice.ts +40 -0
- package/Overlay.css +8 -0
- package/Overlay.js +25 -0
- package/Overlay.js.map +1 -0
- package/Overlay.ts +33 -0
- package/Pager.css +33 -0
- package/Pager.js +44 -0
- package/Pager.js.map +1 -0
- package/Pager.ts +56 -0
- package/Pairs.css +50 -0
- package/Pairs.js +45 -0
- package/Pairs.js.map +1 -0
- package/Pairs.ts +88 -0
- package/Palette.css +77 -0
- package/Palette.js +41 -0
- package/Palette.js.map +1 -0
- package/Palette.ts +44 -0
- package/Panes.css +68 -0
- package/Panes.js +100 -0
- package/Panes.js.map +1 -0
- package/Panes.ts +97 -0
- package/Passage.css +58 -0
- package/Passage.js +80 -0
- package/Passage.js.map +1 -0
- package/Passage.ts +112 -0
- package/Peek.css +75 -0
- package/Peek.js +51 -0
- package/Peek.js.map +1 -0
- package/Peek.ts +74 -0
- package/Pills.css +127 -0
- package/Pills.js +119 -0
- package/Pills.js.map +1 -0
- package/Pills.ts +131 -0
- package/Plan.css +73 -0
- package/Plan.js +62 -0
- package/Plan.js.map +1 -0
- package/Plan.ts +80 -0
- package/Popover.css +47 -0
- package/Popover.js +62 -0
- package/Popover.js.map +1 -0
- package/Popover.ts +80 -0
- package/Preview.css +89 -0
- package/Preview.js +84 -0
- package/Preview.js.map +1 -0
- package/Preview.ts +98 -0
- package/Prop.css +117 -0
- package/Prop.js +94 -0
- package/Prop.js.map +1 -0
- package/Prop.ts +91 -0
- package/Quote.css +55 -0
- package/Quote.js +79 -0
- package/Quote.js.map +1 -0
- package/Quote.ts +85 -0
- package/README.md +596 -2
- package/Report.css +76 -0
- package/Report.js +105 -0
- package/Report.js.map +1 -0
- package/Report.ts +118 -0
- package/Rows.css +289 -0
- package/Rows.js +265 -0
- package/Rows.js.map +1 -0
- package/Rows.ts +337 -0
- package/Save.css +112 -0
- package/Save.js +100 -0
- package/Save.js.map +1 -0
- package/Save.ts +102 -0
- package/Section.css +52 -0
- package/Section.js +73 -0
- package/Section.js.map +1 -0
- package/Section.ts +86 -0
- package/Select.css +140 -0
- package/Select.js +208 -0
- package/Select.js.map +1 -0
- package/Select.ts +238 -0
- package/Shell.css +292 -0
- package/Shell.js +197 -0
- package/Shell.js.map +1 -0
- package/Shell.ts +193 -0
- package/SideNav.css +105 -0
- package/SideNav.js +197 -0
- package/SideNav.js.map +1 -0
- package/SideNav.ts +189 -0
- package/Skip.css +11 -0
- package/Skip.js +18 -0
- package/Skip.js.map +1 -0
- package/Skip.ts +16 -0
- package/Spark.css +14 -0
- package/Spark.js +84 -0
- package/Spark.js.map +1 -0
- package/Spark.ts +67 -0
- package/Stack.css +13 -0
- package/Stack.js +20 -0
- package/Stack.js.map +1 -0
- package/Stack.ts +31 -0
- package/Stamp.css +11 -0
- package/Stamp.js +40 -0
- package/Stamp.js.map +1 -0
- package/Stamp.ts +62 -0
- package/State.css +10 -0
- package/State.js +38 -0
- package/State.js.map +1 -0
- package/State.ts +38 -0
- package/Surface.css +139 -0
- package/Surface.js +79 -0
- package/Surface.js.map +1 -0
- package/Surface.ts +55 -0
- package/Table.css +147 -0
- package/Table.js +289 -0
- package/Table.js.map +1 -0
- package/Table.ts +343 -0
- package/Tabs.css +100 -0
- package/Tabs.js +108 -0
- package/Tabs.js.map +1 -0
- package/Tabs.ts +111 -0
- package/Tile.css +164 -0
- package/Tile.js +211 -0
- package/Tile.js.map +1 -0
- package/Tile.ts +174 -0
- package/Time.css +5 -0
- package/Time.js +80 -0
- package/Time.js.map +1 -0
- package/Time.ts +105 -0
- package/Timeline.css +35 -0
- package/Timeline.js +55 -0
- package/Timeline.js.map +1 -0
- package/Timeline.ts +84 -0
- package/Tip.css +18 -0
- package/Tip.js +24 -0
- package/Tip.js.map +1 -0
- package/Tip.ts +29 -0
- package/Toast.css +25 -0
- package/Toast.js +32 -0
- package/Toast.js.map +1 -0
- package/Toast.ts +34 -0
- package/Toolbar.css +66 -0
- package/Toolbar.js +58 -0
- package/Toolbar.js.map +1 -0
- package/Toolbar.ts +68 -0
- package/Transcript.css +221 -0
- package/Transcript.js +254 -0
- package/Transcript.js.map +1 -0
- package/Transcript.ts +296 -0
- package/Turns.css +49 -0
- package/Turns.js +58 -0
- package/Turns.js.map +1 -0
- package/Turns.ts +67 -0
- package/Value.css +33 -0
- package/Value.js +60 -0
- package/Value.js.map +1 -0
- package/Value.ts +48 -0
- package/_dist/Address.d.ts +3 -0
- package/_dist/Address.d.ts.map +1 -0
- package/_dist/Annotated.d.ts +3 -0
- package/_dist/Annotated.d.ts.map +1 -0
- package/_dist/AppShell.d.ts +3 -0
- package/_dist/AppShell.d.ts.map +1 -0
- package/_dist/At.d.ts +14 -0
- package/_dist/At.d.ts.map +1 -0
- package/_dist/Attachments.d.ts +6 -0
- package/_dist/Attachments.d.ts.map +1 -0
- package/_dist/Badge.d.ts +19 -0
- package/_dist/Badge.d.ts.map +1 -0
- package/_dist/Body.d.ts +5 -0
- package/_dist/Body.d.ts.map +1 -0
- package/_dist/Button.d.ts +18 -0
- package/_dist/Button.d.ts.map +1 -0
- package/_dist/Card.d.ts +28 -0
- package/_dist/Card.d.ts.map +1 -0
- package/_dist/Cards.d.ts +15 -0
- package/_dist/Cards.d.ts.map +1 -0
- package/_dist/Catalog.d.ts +3 -0
- package/_dist/Catalog.d.ts.map +1 -0
- package/_dist/Chart.d.ts +5 -0
- package/_dist/Chart.d.ts.map +1 -0
- package/_dist/Check.d.ts +17 -0
- package/_dist/Check.d.ts.map +1 -0
- package/_dist/Chip.d.ts +22 -0
- package/_dist/Chip.d.ts.map +1 -0
- package/_dist/Chips.d.ts +15 -0
- package/_dist/Chips.d.ts.map +1 -0
- package/_dist/Choices.d.ts +3 -0
- package/_dist/Choices.d.ts.map +1 -0
- package/_dist/Combobox.d.ts +55 -0
- package/_dist/Combobox.d.ts.map +1 -0
- package/_dist/Composer.d.ts +15 -0
- package/_dist/Composer.d.ts.map +1 -0
- package/_dist/Contents.d.ts +20 -0
- package/_dist/Contents.d.ts.map +1 -0
- package/_dist/Copy.d.ts +24 -0
- package/_dist/Copy.d.ts.map +1 -0
- package/_dist/Doc.d.ts +3 -0
- package/_dist/Doc.d.ts.map +1 -0
- package/_dist/Dock.d.ts +29 -0
- package/_dist/Dock.d.ts.map +1 -0
- package/_dist/Dot.d.ts +16 -0
- package/_dist/Dot.d.ts.map +1 -0
- package/_dist/Drop.d.ts +27 -0
- package/_dist/Drop.d.ts.map +1 -0
- package/_dist/Edit.d.ts +3 -0
- package/_dist/Edit.d.ts.map +1 -0
- package/_dist/Empty.d.ts +16 -0
- package/_dist/Empty.d.ts.map +1 -0
- package/_dist/ErrorNotice.d.ts +16 -0
- package/_dist/ErrorNotice.d.ts.map +1 -0
- package/_dist/Field.d.ts +53 -0
- package/_dist/Field.d.ts.map +1 -0
- package/_dist/Form.d.ts +44 -0
- package/_dist/Form.d.ts.map +1 -0
- package/_dist/Gallery.d.ts +3 -0
- package/_dist/Gallery.d.ts.map +1 -0
- package/_dist/Group.d.ts +14 -0
- package/_dist/Group.d.ts.map +1 -0
- package/_dist/Head.d.ts +13 -0
- package/_dist/Head.d.ts.map +1 -0
- package/_dist/Icon.d.ts +23 -0
- package/_dist/Icon.d.ts.map +1 -0
- package/_dist/IconButton.d.ts +8 -0
- package/_dist/IconButton.d.ts.map +1 -0
- package/_dist/Id.d.ts +3 -0
- package/_dist/Id.d.ts.map +1 -0
- package/_dist/Identity.d.ts +15 -0
- package/_dist/Identity.d.ts.map +1 -0
- package/_dist/Index.d.ts +3 -0
- package/_dist/Index.d.ts.map +1 -0
- package/_dist/Layer.d.ts +8 -0
- package/_dist/Layer.d.ts.map +1 -0
- package/_dist/Lightbox.d.ts +27 -0
- package/_dist/Lightbox.d.ts.map +1 -0
- package/_dist/Loading.d.ts +24 -0
- package/_dist/Loading.d.ts.map +1 -0
- package/_dist/Logo.d.ts +26 -0
- package/_dist/Logo.d.ts.map +1 -0
- package/_dist/Match.d.ts +5 -0
- package/_dist/Match.d.ts.map +1 -0
- package/_dist/Menu.d.ts +23 -0
- package/_dist/Menu.d.ts.map +1 -0
- package/_dist/Meter.d.ts +10 -0
- package/_dist/Meter.d.ts.map +1 -0
- package/_dist/Metrics.d.ts +3 -0
- package/_dist/Metrics.d.ts.map +1 -0
- package/_dist/Modal.d.ts +32 -0
- package/_dist/Modal.d.ts.map +1 -0
- package/_dist/More.d.ts +29 -0
- package/_dist/More.d.ts.map +1 -0
- package/_dist/Notes.d.ts +3 -0
- package/_dist/Notes.d.ts.map +1 -0
- package/_dist/Notice.d.ts +15 -0
- package/_dist/Notice.d.ts.map +1 -0
- package/_dist/Overlay.d.ts +3 -0
- package/_dist/Overlay.d.ts.map +1 -0
- package/_dist/Pager.d.ts +3 -0
- package/_dist/Pager.d.ts.map +1 -0
- package/_dist/Pairs.d.ts +3 -0
- package/_dist/Pairs.d.ts.map +1 -0
- package/_dist/Palette.d.ts +3 -0
- package/_dist/Palette.d.ts.map +1 -0
- package/_dist/Panes.d.ts +3 -0
- package/_dist/Panes.d.ts.map +1 -0
- package/_dist/Passage.d.ts +3 -0
- package/_dist/Passage.d.ts.map +1 -0
- package/_dist/Peek.d.ts +3 -0
- package/_dist/Peek.d.ts.map +1 -0
- package/_dist/Pills.d.ts +3 -0
- package/_dist/Pills.d.ts.map +1 -0
- package/_dist/Plan.d.ts +4 -0
- package/_dist/Plan.d.ts.map +1 -0
- package/_dist/Popover.d.ts +3 -0
- package/_dist/Popover.d.ts.map +1 -0
- package/_dist/Preview.d.ts +8 -0
- package/_dist/Preview.d.ts.map +1 -0
- package/_dist/Prop.d.ts +7 -0
- package/_dist/Prop.d.ts.map +1 -0
- package/_dist/Quote.d.ts +3 -0
- package/_dist/Quote.d.ts.map +1 -0
- package/_dist/Report.d.ts +8 -0
- package/_dist/Report.d.ts.map +1 -0
- package/_dist/Rows.d.ts +36 -0
- package/_dist/Rows.d.ts.map +1 -0
- package/_dist/Save.d.ts +4 -0
- package/_dist/Save.d.ts.map +1 -0
- package/_dist/Section.d.ts +3 -0
- package/_dist/Section.d.ts.map +1 -0
- package/_dist/Select.d.ts +29 -0
- package/_dist/Select.d.ts.map +1 -0
- package/_dist/Shell.d.ts +3 -0
- package/_dist/Shell.d.ts.map +1 -0
- package/_dist/SideNav.d.ts +31 -0
- package/_dist/SideNav.d.ts.map +1 -0
- package/_dist/Skip.d.ts +3 -0
- package/_dist/Skip.d.ts.map +1 -0
- package/_dist/Spark.d.ts +9 -0
- package/_dist/Spark.d.ts.map +1 -0
- package/_dist/Stack.d.ts +11 -0
- package/_dist/Stack.d.ts.map +1 -0
- package/_dist/Stamp.d.ts +3 -0
- package/_dist/Stamp.d.ts.map +1 -0
- package/_dist/State.d.ts +16 -0
- package/_dist/State.d.ts.map +1 -0
- package/_dist/Surface.d.ts +7 -0
- package/_dist/Surface.d.ts.map +1 -0
- package/_dist/Table.d.ts +10 -0
- package/_dist/Table.d.ts.map +1 -0
- package/_dist/Tabs.d.ts +30 -0
- package/_dist/Tabs.d.ts.map +1 -0
- package/_dist/Tile.d.ts +3 -0
- package/_dist/Tile.d.ts.map +1 -0
- package/_dist/Time.d.ts +24 -0
- package/_dist/Time.d.ts.map +1 -0
- package/_dist/Timeline.d.ts +3 -0
- package/_dist/Timeline.d.ts.map +1 -0
- package/_dist/Tip.d.ts +3 -0
- package/_dist/Tip.d.ts.map +1 -0
- package/_dist/Toast.d.ts +5 -0
- package/_dist/Toast.d.ts.map +1 -0
- package/_dist/Toolbar.d.ts +3 -0
- package/_dist/Toolbar.d.ts.map +1 -0
- package/_dist/Transcript.d.ts +35 -0
- package/_dist/Transcript.d.ts.map +1 -0
- package/_dist/Turns.d.ts +3 -0
- package/_dist/Turns.d.ts.map +1 -0
- package/_dist/Value.d.ts +3 -0
- package/_dist/Value.d.ts.map +1 -0
- package/_dist/ahead.d.ts +41 -0
- package/_dist/ahead.d.ts.map +1 -0
- package/_dist/chart-marks.d.ts +75 -0
- package/_dist/chart-marks.d.ts.map +1 -0
- package/_dist/clock.d.ts +4 -0
- package/_dist/clock.d.ts.map +1 -0
- package/_dist/contents-browser.d.ts +29 -0
- package/_dist/contents-browser.d.ts.map +1 -0
- package/_dist/contributions.d.ts +5 -0
- package/_dist/contributions.d.ts.map +1 -0
- package/_dist/copy-browser.d.ts +4 -0
- package/_dist/copy-browser.d.ts.map +1 -0
- package/_dist/el.d.ts +58 -0
- package/_dist/el.d.ts.map +1 -0
- package/_dist/everforest.d.ts +8 -0
- package/_dist/everforest.d.ts.map +1 -0
- package/_dist/float.d.ts +55 -0
- package/_dist/float.d.ts.map +1 -0
- package/_dist/gouache.d.ts +9 -0
- package/_dist/gouache.d.ts.map +1 -0
- package/_dist/guide.d.ts +38 -0
- package/_dist/guide.d.ts.map +1 -0
- package/_dist/halved.d.ts +3 -0
- package/_dist/halved.d.ts.map +1 -0
- package/_dist/history.d.ts +15 -0
- package/_dist/history.d.ts.map +1 -0
- package/_dist/interaction.d.ts +15 -0
- package/_dist/interaction.d.ts.map +1 -0
- package/_dist/kit.d.ts +30 -0
- package/_dist/kit.d.ts.map +1 -0
- package/_dist/ledger.d.ts +3 -0
- package/_dist/ledger.d.ts.map +1 -0
- package/_dist/linen.d.ts +8 -0
- package/_dist/linen.d.ts.map +1 -0
- package/_dist/menus-browser.d.ts +2 -0
- package/_dist/menus-browser.d.ts.map +1 -0
- package/_dist/menus.d.ts +6 -0
- package/_dist/menus.d.ts.map +1 -0
- package/_dist/mod.d.ts +47 -0
- package/_dist/mod.d.ts.map +1 -0
- package/_dist/modal-browser.d.ts +2 -0
- package/_dist/modal-browser.d.ts.map +1 -0
- package/_dist/modal-head.d.ts +43 -0
- package/_dist/modal-head.d.ts.map +1 -0
- package/_dist/navigate.d.ts +170 -0
- package/_dist/navigate.d.ts.map +1 -0
- package/_dist/overlays.d.ts +16 -0
- package/_dist/overlays.d.ts.map +1 -0
- package/_dist/palette-browser.d.ts +3 -0
- package/_dist/palette-browser.d.ts.map +1 -0
- package/_dist/panes-browser.d.ts +4 -0
- package/_dist/panes-browser.d.ts.map +1 -0
- package/_dist/paper.d.ts +6 -0
- package/_dist/paper.d.ts.map +1 -0
- package/_dist/parts.d.ts +102 -0
- package/_dist/parts.d.ts.map +1 -0
- package/_dist/pencil.d.ts +6 -0
- package/_dist/pencil.d.ts.map +1 -0
- package/_dist/placement.d.ts +12 -0
- package/_dist/placement.d.ts.map +1 -0
- package/_dist/relative.d.ts +41 -0
- package/_dist/relative.d.ts.map +1 -0
- package/_dist/rosepine.d.ts +8 -0
- package/_dist/rosepine.d.ts.map +1 -0
- package/_dist/routes.d.ts +20 -0
- package/_dist/routes.d.ts.map +1 -0
- package/_dist/sheet.d.ts +44 -0
- package/_dist/sheet.d.ts.map +1 -0
- package/_dist/slide.d.ts +4 -0
- package/_dist/slide.d.ts.map +1 -0
- package/_dist/stock.d.ts +21 -0
- package/_dist/stock.d.ts.map +1 -0
- package/_dist/store.d.ts +2 -0
- package/_dist/store.d.ts.map +1 -0
- package/_dist/theme.d.ts +102 -0
- package/_dist/theme.d.ts.map +1 -0
- package/_dist/ui.d.ts +2 -0
- package/_dist/ui.d.ts.map +1 -0
- package/_dist/video-cover.d.ts +3 -0
- package/_dist/video-cover.d.ts.map +1 -0
- package/_dist/viewport.d.ts +14 -0
- package/_dist/viewport.d.ts.map +1 -0
- package/_dist/wear.d.ts +5 -0
- package/_dist/wear.d.ts.map +1 -0
- package/ahead.js +81 -0
- package/ahead.js.map +1 -0
- package/ahead.ts +102 -0
- package/base.css +220 -0
- package/base.js +129 -0
- package/base.js.map +1 -0
- package/base.ts +127 -0
- package/chart-marks.js +156 -0
- package/chart-marks.js.map +1 -0
- package/chart-marks.ts +221 -0
- package/clock.js +41 -0
- package/clock.js.map +1 -0
- package/clock.ts +39 -0
- package/contents-browser.js +122 -0
- package/contents-browser.js.map +1 -0
- package/contents-browser.ts +135 -0
- package/contributions.js +28 -0
- package/contributions.js.map +1 -0
- package/contributions.ts +21 -0
- package/copy-browser.js +39 -0
- package/copy-browser.js.map +1 -0
- package/copy-browser.ts +44 -0
- package/deno.json +1 -0
- package/derived.css +64 -0
- package/el.js +176 -0
- package/el.js.map +1 -0
- package/el.ts +240 -0
- package/everforest.css +65 -0
- package/everforest.js +54 -0
- package/everforest.js.map +1 -0
- package/everforest.ts +52 -0
- package/float.js +182 -0
- package/float.js.map +1 -0
- package/float.ts +222 -0
- package/gouache.css +62 -0
- package/gouache.js +54 -0
- package/gouache.js.map +1 -0
- package/gouache.ts +52 -0
- package/guide.js +124 -0
- package/guide.js.map +1 -0
- package/guide.ts +222 -0
- package/halved.js +88 -0
- package/halved.js.map +1 -0
- package/halved.ts +102 -0
- package/history.js +11 -0
- package/history.js.map +1 -0
- package/history.ts +22 -0
- package/interaction.js +23 -0
- package/interaction.js.map +1 -0
- package/interaction.ts +43 -0
- package/kit.js +345 -0
- package/kit.js.map +1 -0
- package/kit.ts +408 -0
- package/ledger/Button.css +22 -0
- package/ledger/Head.css +72 -0
- package/ledger/Tabs.css +19 -0
- package/ledger/Tile.css +12 -0
- package/ledger.js +52 -0
- package/ledger.js.map +1 -0
- package/ledger.ts +34 -0
- package/linen.css +71 -0
- package/linen.js +54 -0
- package/linen.js.map +1 -0
- package/linen.ts +52 -0
- package/lucide.d.ts +4 -0
- package/menus-browser.js +72 -0
- package/menus-browser.js.map +1 -0
- package/menus-browser.ts +75 -0
- package/menus.js +84 -0
- package/menus.js.map +1 -0
- package/menus.ts +90 -0
- package/mod.js +46 -0
- package/mod.js.map +1 -0
- package/mod.ts +78 -0
- package/modal-browser.js +29 -0
- package/modal-browser.js.map +1 -0
- package/modal-browser.ts +31 -0
- package/modal-head.js +75 -0
- package/modal-head.js.map +1 -0
- package/modal-head.ts +81 -0
- package/navigate.js +934 -0
- package/navigate.js.map +1 -0
- package/navigate.ts +1177 -0
- package/overlays.js +177 -0
- package/overlays.js.map +1 -0
- package/overlays.ts +257 -0
- package/package.json +280 -4
- package/palette-browser.js +52 -0
- package/palette-browser.js.map +1 -0
- package/palette-browser.ts +54 -0
- package/panes-browser.js +40 -0
- package/panes-browser.js.map +1 -0
- package/panes-browser.ts +59 -0
- package/paper/base.css +28 -0
- package/paper/grain.css +18 -0
- package/paper.js +14 -0
- package/paper.js.map +1 -0
- package/paper.ts +16 -0
- package/parts.js +102 -0
- package/parts.js.map +1 -0
- package/parts.ts +117 -0
- package/pencil/Address.css +5 -0
- package/pencil/At.css +14 -0
- package/pencil/Body.css +10 -0
- package/pencil/Button.css +81 -0
- package/pencil/Card.css +175 -0
- package/pencil/Chart.css +31 -0
- package/pencil/Check.css +66 -0
- package/pencil/Chip.css +100 -0
- package/pencil/Chips.css +6 -0
- package/pencil/Copy.css +33 -0
- package/pencil/Drop.css +145 -0
- package/pencil/Empty.css +48 -0
- package/pencil/Field.css +42 -0
- package/pencil/Form.css +88 -0
- package/pencil/Loading.css +14 -0
- package/pencil/Menu.css +26 -0
- package/pencil/More.css +41 -0
- package/pencil/Report.css +11 -0
- package/pencil/Rows.css +48 -0
- package/pencil/SideNav.css +173 -0
- package/pencil/State.css +28 -0
- package/pencil/Surface.css +69 -0
- package/pencil/Tabs.css +137 -0
- package/pencil/base.css +19 -0
- package/pencil/paper.webp +0 -0
- package/pencil/pencil.svg +181 -0
- package/pencil.js +81 -0
- package/pencil.js.map +1 -0
- package/pencil.ts +34 -0
- package/placement.js +62 -0
- package/placement.js.map +1 -0
- package/placement.ts +93 -0
- package/relative.js +150 -0
- package/relative.js.map +1 -0
- package/relative.ts +186 -0
- package/resizes.js +23 -0
- package/resizes.js.map +1 -0
- package/resizes.ts +37 -0
- package/rosepine.css +59 -0
- package/rosepine.js +54 -0
- package/rosepine.js.map +1 -0
- package/rosepine.ts +52 -0
- package/routes.js +136 -0
- package/routes.js.map +1 -0
- package/routes.ts +190 -0
- package/sheet.js +7 -0
- package/sheet.js.map +1 -0
- package/sheet.ts +72 -0
- package/slide.js +37 -0
- package/slide.js.map +1 -0
- package/slide.ts +41 -0
- package/stock.js +38 -0
- package/stock.js.map +1 -0
- package/stock.ts +54 -0
- package/store.js +6 -0
- package/store.js.map +1 -0
- package/store.ts +14 -0
- package/theme.js +21 -0
- package/theme.js.map +1 -0
- package/theme.ts +159 -0
- package/ui.js +2 -0
- package/ui.js.map +1 -0
- package/ui.ts +2 -0
- package/video-cover.js +55 -0
- package/video-cover.js.map +1 -0
- package/video-cover.ts +72 -0
- package/viewport.js +56 -0
- package/viewport.js.map +1 -0
- package/viewport.ts +61 -0
- package/wear-build.ts +12 -0
- package/wear.js +40 -0
- package/wear.js.map +1 -0
- package/wear.ts +65 -0
package/stock.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The stock kit, every part in Linen, for a page that asks for it: a yaks
|
|
3
|
+
* app's page imports this and awaits it before drawing, and its controls wear
|
|
4
|
+
* the kit. The page's own sheets come after it, so the page wins.
|
|
5
|
+
*
|
|
6
|
+
* ```ts ignore
|
|
7
|
+
* import { wearStock } from '@yaks/ui/stock'
|
|
8
|
+
* await wearStock()
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* The sheet is one file the compiler writes beside this module
|
|
12
|
+
* (wear-build.ts), so a page loads no part modules to get it. A page that
|
|
13
|
+
* composes its own kit, theme or skin uses `@yaks/ui/wear`.
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/** The stock Linen stylesheet generated for compiled browser packages. */
|
|
19
|
+
export let linenAsset = 'wear-linen.css'
|
|
20
|
+
|
|
21
|
+
/** Link a sheet before `before`, settling true once it loads and false if it
|
|
22
|
+
* fails; `forget` takes a failed link back out. */
|
|
23
|
+
export let linkSheet = (
|
|
24
|
+
doc: Document,
|
|
25
|
+
before: Element | null,
|
|
26
|
+
href: string,
|
|
27
|
+
forget = false,
|
|
28
|
+
): Promise<boolean> =>
|
|
29
|
+
new Promise<boolean>((done) => {
|
|
30
|
+
let link = doc.createElement('link')
|
|
31
|
+
link.rel = 'stylesheet'
|
|
32
|
+
link.href = href
|
|
33
|
+
link.onload = () => done(true)
|
|
34
|
+
link.onerror = () => {
|
|
35
|
+
if (forget) link.remove()
|
|
36
|
+
done(false)
|
|
37
|
+
}
|
|
38
|
+
doc.head.insertBefore(link, before)
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
/** Link the stock kit's sheet before the page's first stylesheet, once,
|
|
42
|
+
* settling when it has loaded or failed. */
|
|
43
|
+
export let wearStock = async (
|
|
44
|
+
doc: Document = document,
|
|
45
|
+
moduleUrl: string = import.meta.url,
|
|
46
|
+
): Promise<void> => {
|
|
47
|
+
let href = new URL(linenAsset, moduleUrl).href
|
|
48
|
+
let linked = [
|
|
49
|
+
...doc.querySelectorAll<HTMLLinkElement>('link[rel=stylesheet]'),
|
|
50
|
+
]
|
|
51
|
+
.some((l) => l.href == href)
|
|
52
|
+
if (linked) return
|
|
53
|
+
await linkSheet(doc, doc.querySelector('link[rel=stylesheet],style'), href)
|
|
54
|
+
}
|
package/store.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/* @ts-types="npm:@types/react@19.3.0" */ import { useSyncExternalStore } from "react";
|
|
2
|
+
/** Read a synchronous snapshot on the server and subscribe to it on mount. */ export let useStore = (subscribe, read)=>{
|
|
3
|
+
let useSnapshot = useSyncExternalStore;
|
|
4
|
+
return useSnapshot(subscribe, read, read);
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=store.js.map
|
package/store.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sources":["./store.ts"],"names":[],"mappings":"AAAA,uCAAuC,GAAG,SAAS,oBAAoB,gBAA0B;AAEjG,4EAA4E,GAC5E,OAAO,IAAI,WAAW,CACpB,WACA;EAEA,IAAI,cAIK;EACT,OAAO,YAAY,WAAW,MAAM;AACtC,EAAC"}
|
package/store.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* @ts-types="npm:@types/react@19.3.0" */ import { useSyncExternalStore } from 'react'
|
|
2
|
+
|
|
3
|
+
/** Read a synchronous snapshot on the server and subscribe to it on mount. */
|
|
4
|
+
export let useStore = <T>(
|
|
5
|
+
subscribe: (changed: () => void) => () => void,
|
|
6
|
+
read: () => T,
|
|
7
|
+
): T => {
|
|
8
|
+
let useSnapshot: (
|
|
9
|
+
subscribe: (changed: () => void) => () => void,
|
|
10
|
+
read: () => T,
|
|
11
|
+
server: () => T,
|
|
12
|
+
) => T = useSyncExternalStore
|
|
13
|
+
return useSnapshot(subscribe, read, read)
|
|
14
|
+
}
|
package/theme.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a theme is. A theme is two faces of one palette: a stylesheet of CSS
|
|
3
|
+
* custom properties (`--bg`, `--dim`, …) that every component's CSS reads
|
|
4
|
+
* through `var()`, and the same colours as values, which a terminal sheet is
|
|
5
|
+
* built from (kit.ts `stylesheet` and `sheet`).
|
|
6
|
+
*
|
|
7
|
+
* Every colour names a role, never a hue: `--number` is a number wherever
|
|
8
|
+
* one shows, whatever colour a theme gives it. A theme's stylesheet sets
|
|
9
|
+
* these names, its type and its spacing, and nothing else.
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/ /** Stylesheets named beside a module: `let at = beside(import.meta.url)`,
|
|
13
|
+
* then `css: at('./x.css')`. Each also says its address as a string, as the
|
|
14
|
+
* URL it replaced did, so shipped app code linking `String(part.css)` keeps
|
|
15
|
+
* its look. */ export let beside = (base)=>(path)=>{
|
|
16
|
+
let url = ()=>new URL(path, base);
|
|
17
|
+
return Object.assign(url, {
|
|
18
|
+
toString: ()=>url().href
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=theme.js.map
|
package/theme.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.js","sources":["./theme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;CAWC,GAsED;;;aAGa,GACb,OAAO,IAAI,SAAS,CAAC,OAAiB,CAAC;IACrC,IAAI,MAAM,IAAM,IAAI,IAAI,MAAM;IAC9B,OAAO,OAAO,MAAM,CAAC,KAAK;MAAE,UAAU,IAAM,MAAM,IAAI;IAAC;EACzD,EAAC"}
|
package/theme.ts
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a theme is. A theme is two faces of one palette: a stylesheet of CSS
|
|
3
|
+
* custom properties (`--bg`, `--dim`, …) that every component's CSS reads
|
|
4
|
+
* through `var()`, and the same colours as values, which a terminal sheet is
|
|
5
|
+
* built from (kit.ts `stylesheet` and `sheet`).
|
|
6
|
+
*
|
|
7
|
+
* Every colour names a role, never a hue: `--number` is a number wherever
|
|
8
|
+
* one shows, whatever colour a theme gives it. A theme's stylesheet sets
|
|
9
|
+
* these names, its type and its spacing, and nothing else.
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import type { Sheet } from './sheet.ts'
|
|
15
|
+
/* @ts-types="npm:@types/react@19.3.0" */ import type { ComponentType, JSX } from 'npm:react@19.3.0'
|
|
16
|
+
|
|
17
|
+
/** A theme's colours, named as its custom properties are (`hues` are
|
|
18
|
+
* `--hue-0` to `--hue-5`). A terminal paints with one palette; where the
|
|
19
|
+
* stylesheet has a light and a dark scheme, these are the dark. */
|
|
20
|
+
export type Colors = {
|
|
21
|
+
/** the floor */
|
|
22
|
+
bg: string
|
|
23
|
+
/** panels and chrome */
|
|
24
|
+
surface: string
|
|
25
|
+
/** a raised body */
|
|
26
|
+
card: string
|
|
27
|
+
border: string
|
|
28
|
+
/** a stronger border */
|
|
29
|
+
border2: string
|
|
30
|
+
/** the foreground */
|
|
31
|
+
text: string
|
|
32
|
+
muted: string
|
|
33
|
+
dim: string
|
|
34
|
+
/** selection and the primary action */
|
|
35
|
+
accent: string
|
|
36
|
+
/** a link, whatever part it is in */
|
|
37
|
+
link: string
|
|
38
|
+
/** a section's title: the text's own ink in both themes, set apart by
|
|
39
|
+
* size and weight, not hue */
|
|
40
|
+
heading: string
|
|
41
|
+
/** the tones a state is said in (a `Dot`'s): something to know, or still
|
|
42
|
+
* open */
|
|
43
|
+
info: string
|
|
44
|
+
/** under way */
|
|
45
|
+
active: string
|
|
46
|
+
/** went well: done, passed, approved */
|
|
47
|
+
positive: string
|
|
48
|
+
/** went wrong, or would destroy something */
|
|
49
|
+
negative: string
|
|
50
|
+
/** needs watching */
|
|
51
|
+
caution: string
|
|
52
|
+
/** set apart from the rest */
|
|
53
|
+
special: string
|
|
54
|
+
/** a number, stored or in code */
|
|
55
|
+
number: string
|
|
56
|
+
/** true, false and null, stored or in code */
|
|
57
|
+
literal: string
|
|
58
|
+
/** a moment */
|
|
59
|
+
time: string
|
|
60
|
+
/** who did it: a person or a session */
|
|
61
|
+
who: string
|
|
62
|
+
/** code: the language's own words */
|
|
63
|
+
keyword: string
|
|
64
|
+
/** code: a string */
|
|
65
|
+
string: string
|
|
66
|
+
/** code: a function's or a class's name */
|
|
67
|
+
fn: string
|
|
68
|
+
/** code: a type, or what the language builds in */
|
|
69
|
+
type: string
|
|
70
|
+
/** code: an attribute or a variable */
|
|
71
|
+
attr: string
|
|
72
|
+
/** six colours that only tell things apart (a `Chip`'s), none of them a
|
|
73
|
+
* role */
|
|
74
|
+
hues: [string, string, string, string, string, string]
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** A stylesheet's address, resolved when the sheet is read, never when its
|
|
78
|
+
* module loads: a bundled Worker has no module address to resolve against,
|
|
79
|
+
* so `new URL('./x.css', import.meta.url)` at load throws there. */
|
|
80
|
+
export type Stylesheet = () => URL
|
|
81
|
+
|
|
82
|
+
/** Stylesheets named beside a module: `let at = beside(import.meta.url)`,
|
|
83
|
+
* then `css: at('./x.css')`. Each also says its address as a string, as the
|
|
84
|
+
* URL it replaced did, so shipped app code linking `String(part.css)` keeps
|
|
85
|
+
* its look. */
|
|
86
|
+
export let beside = (base: string) => (path: string): Stylesheet => {
|
|
87
|
+
let url = () => new URL(path, base)
|
|
88
|
+
return Object.assign(url, { toString: () => url().href })
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** A theme: its custom properties, and their colours. */
|
|
92
|
+
export type Theme = {
|
|
93
|
+
/** the stylesheet defining the custom properties */
|
|
94
|
+
css: Stylesheet
|
|
95
|
+
colors: Colors
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** A native style: a React Native style object's keys and values. */
|
|
99
|
+
export type Style = Record<string, string | number>
|
|
100
|
+
|
|
101
|
+
/** A part's native entries: the style of each class it renders, beside its
|
|
102
|
+
* terminal `sheet`, which a native host draws its views with (@yaks/native). */
|
|
103
|
+
export type Native = Record<string, Style>
|
|
104
|
+
|
|
105
|
+
/** One sample in the style guide: what it shows, and the tree. */
|
|
106
|
+
export type Specimen = [label: string, node: JSX.Element]
|
|
107
|
+
|
|
108
|
+
/** What each part of the kit brings besides its component: a line saying
|
|
109
|
+
* what it is, its terminal entries, its native ones where it has a native
|
|
110
|
+
* look, and its samples. Its CSS address travels with the part, wherever its
|
|
111
|
+
* author keeps it. */
|
|
112
|
+
export type Piece = {
|
|
113
|
+
// Kits contain components with different props; consumers import their typed component.
|
|
114
|
+
// deno-lint-ignore no-explicit-any -- heterogeneous component registry
|
|
115
|
+
Component: ComponentType<any>
|
|
116
|
+
css: Stylesheet
|
|
117
|
+
description: string
|
|
118
|
+
sheet: (c: Colors) => Sheet
|
|
119
|
+
native?: (c: Colors) => Native
|
|
120
|
+
specimens: () => Specimen[]
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** A kit names a set of parts. Skin keys are bare names or kit/name. */
|
|
124
|
+
export type Kit = Record<string, Piece>
|
|
125
|
+
|
|
126
|
+
/** Another rendering of just the parts it changes, keyed by kit/name or a bare
|
|
127
|
+
* name matching every kit. An entry's `css` replaces
|
|
128
|
+
* the part's own, and its `over` (one sheet or several, in order) is laid on
|
|
129
|
+
* top of whichever the part wears, so a skin can add to a part without
|
|
130
|
+
* copying it, and two skins can share what they lay. Missing entries fall back
|
|
131
|
+
* to the kit; a missing terminal sheet or native entry keeps the kit's. */
|
|
132
|
+
export type Skin = Record<string, {
|
|
133
|
+
css?: Stylesheet
|
|
134
|
+
over?: Stylesheet | Stylesheet[]
|
|
135
|
+
sheet?: (c: Colors) => Sheet
|
|
136
|
+
native?: (c: Colors) => Native
|
|
137
|
+
}>
|
|
138
|
+
|
|
139
|
+
/** The guide only needs UX specimens, not a dependency on their behaviour. */
|
|
140
|
+
export type Behaviours = Record<string, {
|
|
141
|
+
description: string
|
|
142
|
+
components: Record<string, Pick<Piece, 'description' | 'specimens'>>
|
|
143
|
+
}>
|
|
144
|
+
|
|
145
|
+
/** Browser-safe contributions from a plugin's ./ui facet. */
|
|
146
|
+
export type Contributions = {
|
|
147
|
+
kits?: Record<string, Kit>
|
|
148
|
+
ux?: Behaviours
|
|
149
|
+
themes?: Record<string, Theme>
|
|
150
|
+
skins?: Record<string, Skin>
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/** The same value dresses a page and its guide in both renderers. */
|
|
154
|
+
export type Composition = {
|
|
155
|
+
kits: Record<string, Kit>
|
|
156
|
+
theme: Theme
|
|
157
|
+
skin?: Skin
|
|
158
|
+
ux?: Behaviours
|
|
159
|
+
}
|
package/ui.js
ADDED
package/ui.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.js","sources":["./ui.ts"],"names":[],"mappings":"AAAA,6DAA6D,GAC7D,SAAS,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,mBAAkB"}
|
package/ui.ts
ADDED
package/video-cover.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/** The image variant of a video address, retaining any other route arguments. */ export let posterUrl = (src, width = 640, base = document.baseURI)=>{
|
|
2
|
+
let url = new URL(src, base);
|
|
3
|
+
url.searchParams.delete('download');
|
|
4
|
+
url.searchParams.set('width', String(width));
|
|
5
|
+
// Older poster responses were immutable even when their stored frame changed.
|
|
6
|
+
url.searchParams.set('poster', '2');
|
|
7
|
+
url.hash = '';
|
|
8
|
+
return url.href;
|
|
9
|
+
};
|
|
10
|
+
/** A film's still and play mark. With controls, the cover plays inline. */ export let videoCover = (src, title, { controls = false, width = 640 } = {})=>{
|
|
11
|
+
let wrap = document.createElement('span');
|
|
12
|
+
wrap.className = 'VideoCover';
|
|
13
|
+
wrap.style.cssText = 'display:grid;position:relative;place-items:center;overflow:hidden;background:#242623';
|
|
14
|
+
wrap.style.aspectRatio = controls ? '16 / 9' : '4 / 3';
|
|
15
|
+
let media = controls ? document.createElement('video') : document.createElement('img');
|
|
16
|
+
media.className = 'VideoCover_Media';
|
|
17
|
+
media.style.cssText = 'position:absolute;inset:0;width:100%;height:100%';
|
|
18
|
+
media.style.objectFit = controls ? 'contain' : 'cover';
|
|
19
|
+
let poster = posterUrl(src, width);
|
|
20
|
+
let play = controls ? document.createElement('button') : document.createElement('span');
|
|
21
|
+
play.className = 'VideoCover_Play';
|
|
22
|
+
play.style.cssText = 'position:relative;display:grid;place-items:center;width:2.75rem;height:2.75rem;border:0;border-radius:50%;background:#161916dc;color:white;font:1rem system-ui';
|
|
23
|
+
play.textContent = '▶';
|
|
24
|
+
if (media instanceof HTMLVideoElement && play instanceof HTMLButtonElement) {
|
|
25
|
+
media.controls = true;
|
|
26
|
+
media.playsInline = true;
|
|
27
|
+
media.preload = 'none';
|
|
28
|
+
media.poster = poster;
|
|
29
|
+
media.src = src;
|
|
30
|
+
media.setAttribute('aria-label', title);
|
|
31
|
+
play.type = 'button';
|
|
32
|
+
play.style.cursor = 'pointer';
|
|
33
|
+
play.setAttribute('aria-label', `Play ${title}`);
|
|
34
|
+
play.addEventListener('click', ()=>{
|
|
35
|
+
// The video's native controls also handle playback and show any errors.
|
|
36
|
+
void media.play().catch(()=>media.focus());
|
|
37
|
+
});
|
|
38
|
+
media.addEventListener('play', ()=>{
|
|
39
|
+
play.style.display = 'none';
|
|
40
|
+
if (document.activeElement == play) media.focus();
|
|
41
|
+
});
|
|
42
|
+
media.addEventListener('ended', ()=>play.style.display = 'grid');
|
|
43
|
+
} else if (media instanceof HTMLImageElement) {
|
|
44
|
+
media.alt = '';
|
|
45
|
+
media.decoding = 'async';
|
|
46
|
+
media.addEventListener('error', ()=>media.remove(), {
|
|
47
|
+
once: true
|
|
48
|
+
});
|
|
49
|
+
media.src = poster;
|
|
50
|
+
play.setAttribute('aria-hidden', 'true');
|
|
51
|
+
}
|
|
52
|
+
wrap.append(media, play);
|
|
53
|
+
return wrap;
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=video-cover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"video-cover.js","sources":["./video-cover.ts"],"names":[],"mappings":"AAAA,+EAA+E,GAC/E,OAAO,IAAI,YAAY,CACrB,KACA,QAAQ,GAAG,EACX,OAAO,SAAS,OAAO;EAEvB,IAAI,MAAM,IAAI,IAAI,KAAK;EACvB,IAAI,YAAY,CAAC,MAAM,CAAC;EACxB,IAAI,YAAY,CAAC,GAAG,CAAC,SAAS,OAAO;EACrC,8EAA8E;EAC9E,IAAI,YAAY,CAAC,GAAG,CAAC,UAAU;EAC/B,IAAI,IAAI,GAAG;EACX,OAAO,IAAI,IAAI;AACjB,EAAC;AAED,yEAAyE,GACzE,OAAO,IAAI,aAAa,CACtB,KACA,OACA,EAAE,WAAW,KAAK,EAAE,QAAQ,GAAG,EAA0C,GACvE,CAAC,CAAC;EAEJ,IAAI,OAAO,SAAS,aAAa,CAAC;EAClC,KAAK,SAAS,GAAG;EACjB,KAAK,KAAK,CAAC,OAAO,GAChB;EACF,KAAK,KAAK,CAAC,WAAW,GAAG,WAAW,WAAW;EAC/C,IAAI,QAAQ,WACR,SAAS,aAAa,CAAC,WACvB,SAAS,aAAa,CAAC;EAC3B,MAAM,SAAS,GAAG;EAClB,MAAM,KAAK,CAAC,OAAO,GAAG;EACtB,MAAM,KAAK,CAAC,SAAS,GAAG,WAAW,YAAY;EAC/C,IAAI,SAAS,UAAU,KAAK;EAC5B,IAAI,OAAO,WACP,SAAS,aAAa,CAAC,YACvB,SAAS,aAAa,CAAC;EAC3B,KAAK,SAAS,GAAG;EACjB,KAAK,KAAK,CAAC,OAAO,GAChB;EACF,KAAK,WAAW,GAAG;EAEnB,IAAI,iBAAiB,oBAAoB,gBAAgB,mBAAmB;IAC1E,MAAM,QAAQ,GAAG;IACjB,MAAM,WAAW,GAAG;IACpB,MAAM,OAAO,GAAG;IAChB,MAAM,MAAM,GAAG;IACf,MAAM,GAAG,GAAG;IACZ,MAAM,YAAY,CAAC,cAAc;IACjC,KAAK,IAAI,GAAG;IACZ,KAAK,KAAK,CAAC,MAAM,GAAG;IACpB,KAAK,YAAY,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO;IAC/C,KAAK,gBAAgB,CAAC,SAAS;MAC7B,wEAAwE;MACxE,KAAK,MAAM,IAAI,GAAG,KAAK,CAAC,IAAM,MAAM,KAAK;IAC3C;IACA,MAAM,gBAAgB,CAAC,QAAQ;MAC7B,KAAK,KAAK,CAAC,OAAO,GAAG;MACrB,IAAI,SAAS,aAAa,IAAI,MAAM,MAAM,KAAK;IACjD;IACA,MAAM,gBAAgB,CAAC,SAAS,IAAM,KAAK,KAAK,CAAC,OAAO,GAAG;EAC7D,OAAO,IAAI,iBAAiB,kBAAkB;IAC5C,MAAM,GAAG,GAAG;IACZ,MAAM,QAAQ,GAAG;IACjB,MAAM,gBAAgB,CAAC,SAAS,IAAM,MAAM,MAAM,IAAI;MAAE,MAAM;IAAK;IACnE,MAAM,GAAG,GAAG;IACZ,KAAK,YAAY,CAAC,eAAe;EACnC;EAEA,KAAK,MAAM,CAAC,OAAO;EACnB,OAAO;AACT,EAAC"}
|
package/video-cover.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/** The image variant of a video address, retaining any other route arguments. */
|
|
2
|
+
export let posterUrl = (
|
|
3
|
+
src: string,
|
|
4
|
+
width = 640,
|
|
5
|
+
base = document.baseURI,
|
|
6
|
+
): string => {
|
|
7
|
+
let url = new URL(src, base)
|
|
8
|
+
url.searchParams.delete('download')
|
|
9
|
+
url.searchParams.set('width', String(width))
|
|
10
|
+
// Older poster responses were immutable even when their stored frame changed.
|
|
11
|
+
url.searchParams.set('poster', '2')
|
|
12
|
+
url.hash = ''
|
|
13
|
+
return url.href
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** A film's still and play mark. With controls, the cover plays inline. */
|
|
17
|
+
export let videoCover = (
|
|
18
|
+
src: string,
|
|
19
|
+
title: string,
|
|
20
|
+
{ controls = false, width = 640 }: { controls?: boolean; width?: number } =
|
|
21
|
+
{},
|
|
22
|
+
): HTMLSpanElement => {
|
|
23
|
+
let wrap = document.createElement('span')
|
|
24
|
+
wrap.className = 'VideoCover'
|
|
25
|
+
wrap.style.cssText =
|
|
26
|
+
'display:grid;position:relative;place-items:center;overflow:hidden;background:#242623'
|
|
27
|
+
wrap.style.aspectRatio = controls ? '16 / 9' : '4 / 3'
|
|
28
|
+
let media = controls
|
|
29
|
+
? document.createElement('video')
|
|
30
|
+
: document.createElement('img')
|
|
31
|
+
media.className = 'VideoCover_Media'
|
|
32
|
+
media.style.cssText = 'position:absolute;inset:0;width:100%;height:100%'
|
|
33
|
+
media.style.objectFit = controls ? 'contain' : 'cover'
|
|
34
|
+
let poster = posterUrl(src, width)
|
|
35
|
+
let play = controls
|
|
36
|
+
? document.createElement('button')
|
|
37
|
+
: document.createElement('span')
|
|
38
|
+
play.className = 'VideoCover_Play'
|
|
39
|
+
play.style.cssText =
|
|
40
|
+
'position:relative;display:grid;place-items:center;width:2.75rem;height:2.75rem;border:0;border-radius:50%;background:#161916dc;color:white;font:1rem system-ui'
|
|
41
|
+
play.textContent = '▶'
|
|
42
|
+
|
|
43
|
+
if (media instanceof HTMLVideoElement && play instanceof HTMLButtonElement) {
|
|
44
|
+
media.controls = true
|
|
45
|
+
media.playsInline = true
|
|
46
|
+
media.preload = 'none'
|
|
47
|
+
media.poster = poster
|
|
48
|
+
media.src = src
|
|
49
|
+
media.setAttribute('aria-label', title)
|
|
50
|
+
play.type = 'button'
|
|
51
|
+
play.style.cursor = 'pointer'
|
|
52
|
+
play.setAttribute('aria-label', `Play ${title}`)
|
|
53
|
+
play.addEventListener('click', () => {
|
|
54
|
+
// The video's native controls also handle playback and show any errors.
|
|
55
|
+
void media.play().catch(() => media.focus())
|
|
56
|
+
})
|
|
57
|
+
media.addEventListener('play', () => {
|
|
58
|
+
play.style.display = 'none'
|
|
59
|
+
if (document.activeElement == play) media.focus()
|
|
60
|
+
})
|
|
61
|
+
media.addEventListener('ended', () => play.style.display = 'grid')
|
|
62
|
+
} else if (media instanceof HTMLImageElement) {
|
|
63
|
+
media.alt = ''
|
|
64
|
+
media.decoding = 'async'
|
|
65
|
+
media.addEventListener('error', () => media.remove(), { once: true })
|
|
66
|
+
media.src = poster
|
|
67
|
+
play.setAttribute('aria-hidden', 'true')
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
wrap.append(media, play)
|
|
71
|
+
return wrap
|
|
72
|
+
}
|
package/viewport.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/** The scrolling body primitive: browser overflow or a terminal window. Each
|
|
2
|
+
* `id` starts scrolled to `start`, such as where a page was left, and
|
|
3
|
+
* `onScroll` hears where a person moves it. */ /* @ts-types="npm:@types/react@19.3.0" */ import { createElement as h, useLayoutEffect, useRef } from "react";
|
|
4
|
+
// A page returned to may draw its rows after it mounts, so the browser's body
|
|
5
|
+
// reaches for its start as they arrive, until it gets there, a person scrolls
|
|
6
|
+
// it themselves, or a moment has passed.
|
|
7
|
+
let Body = ({ start = 0, onScroll, ...props })=>{
|
|
8
|
+
let ref = useRef(null);
|
|
9
|
+
useLayoutEffect(()=>{
|
|
10
|
+
let el = ref.current;
|
|
11
|
+
if (!el) return;
|
|
12
|
+
el.scrollTop = start;
|
|
13
|
+
if (!start || typeof MutationObserver != 'function') return;
|
|
14
|
+
let reach = ()=>{
|
|
15
|
+
el.scrollTop = start;
|
|
16
|
+
if (el.scrollTop >= start) stop();
|
|
17
|
+
};
|
|
18
|
+
let grown = new MutationObserver(reach);
|
|
19
|
+
let stop = ()=>{
|
|
20
|
+
grown.disconnect();
|
|
21
|
+
clearTimeout(timer);
|
|
22
|
+
for (let type of [
|
|
23
|
+
'wheel',
|
|
24
|
+
'touchstart',
|
|
25
|
+
'keydown'
|
|
26
|
+
]){
|
|
27
|
+
el.removeEventListener(type, stop);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
let timer = setTimeout(stop, 2000);
|
|
31
|
+
grown.observe(el, {
|
|
32
|
+
childList: true,
|
|
33
|
+
subtree: true
|
|
34
|
+
});
|
|
35
|
+
for (let type of [
|
|
36
|
+
'wheel',
|
|
37
|
+
'touchstart',
|
|
38
|
+
'keydown'
|
|
39
|
+
]){
|
|
40
|
+
el.addEventListener(type, stop);
|
|
41
|
+
}
|
|
42
|
+
return stop;
|
|
43
|
+
}, [
|
|
44
|
+
props.id
|
|
45
|
+
]);
|
|
46
|
+
return /*#__PURE__*/ h('div', {
|
|
47
|
+
...props,
|
|
48
|
+
ref,
|
|
49
|
+
onScroll: onScroll && ((e)=>onScroll(e.currentTarget.scrollTop))
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
export let installViewport = (body)=>{
|
|
53
|
+
Body = body;
|
|
54
|
+
};
|
|
55
|
+
export let Viewport = (props)=>/*#__PURE__*/ h(Body, props);
|
|
56
|
+
//# sourceMappingURL=viewport.js.map
|
package/viewport.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewport.js","sources":["./viewport.ts"],"names":[],"mappings":"AAAA;;6CAE6C,GAC7C,uCAAuC,GAAG,SACxC,iBAAiB,CAAC,EAGlB,eAAe,EACf,MAAM,gBACiB;AASzB,8EAA8E;AAC9E,8EAA8E;AAC9E,yCAAyC;AACzC,IAAI,OAAyC,CAC3C,EAAE,QAAQ,CAAC,EAAE,QAAQ,EAAE,GAAG,OAAO;EAEjC,IAAI,MAAM,OAAuB;EACjC,gBAAgB;IACd,IAAI,KAAK,IAAI,OAAO;IACpB,IAAI,CAAC,IAAI;IACT,GAAG,SAAS,GAAG;IACf,IAAI,CAAC,SAAS,OAAO,oBAAoB,YAAY;IACrD,IAAI,QAAQ;MACV,GAAG,SAAS,GAAG;MACf,IAAI,GAAG,SAAS,IAAI,OAAO;IAC7B;IACA,IAAI,QAAQ,IAAI,iBAAiB;IACjC,IAAI,OAAO;MACT,MAAM,UAAU;MAChB,aAAa;MACb,KAAK,IAAI,QAAQ;QAAC;QAAS;QAAc;OAAU,CAAE;QACnD,GAAG,mBAAmB,CAAC,MAAM;MAC/B;IACF;IACA,IAAI,QAAQ,WAAW,MAAM;IAC7B,MAAM,OAAO,CAAC,IAAI;MAAE,WAAW;MAAM,SAAS;IAAK;IACnD,KAAK,IAAI,QAAQ;MAAC;MAAS;MAAc;KAAU,CAAE;MACnD,GAAG,gBAAgB,CAAC,MAAM;IAC5B;IACA,OAAO;EACT,GAAG;IAAC,MAAM,EAAE;GAAC;EACb,qBAAO,EAAE,OAAO;IACd,GAAG,KAAK;IACR;IACA,UAAU,YACR,CAAC,CAAC,IAAa,SAAS,AAAC,EAAE,aAAa,CAAiB,SAAS,CAAC;EACvE;AACF;AACA,OAAO,IAAI,kBAAkB,CAAC;EAC5B,OAAO;AACT,EAAC;AACD,OAAO,IAAI,WAA6C,CAAC,sBACvD,EAAE,MAAM,OAAM"}
|
package/viewport.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/** The scrolling body primitive: browser overflow or a terminal window. Each
|
|
2
|
+
* `id` starts scrolled to `start`, such as where a page was left, and
|
|
3
|
+
* `onScroll` hears where a person moves it. */
|
|
4
|
+
/* @ts-types="npm:@types/react@19.3.0" */ import {
|
|
5
|
+
createElement as h,
|
|
6
|
+
type FunctionComponent,
|
|
7
|
+
type ReactNode,
|
|
8
|
+
useLayoutEffect,
|
|
9
|
+
useRef,
|
|
10
|
+
} from 'react'
|
|
11
|
+
export type ViewportProps = {
|
|
12
|
+
id: string
|
|
13
|
+
start?: number
|
|
14
|
+
onScroll?: (top: number) => void
|
|
15
|
+
className?: string
|
|
16
|
+
class?: string
|
|
17
|
+
children?: ReactNode
|
|
18
|
+
}
|
|
19
|
+
// A page returned to may draw its rows after it mounts, so the browser's body
|
|
20
|
+
// reaches for its start as they arrive, until it gets there, a person scrolls
|
|
21
|
+
// it themselves, or a moment has passed.
|
|
22
|
+
let Body: FunctionComponent<ViewportProps> = (
|
|
23
|
+
{ start = 0, onScroll, ...props },
|
|
24
|
+
) => {
|
|
25
|
+
let ref = useRef<HTMLDivElement>(null)
|
|
26
|
+
useLayoutEffect(() => {
|
|
27
|
+
let el = ref.current
|
|
28
|
+
if (!el) return
|
|
29
|
+
el.scrollTop = start
|
|
30
|
+
if (!start || typeof MutationObserver != 'function') return
|
|
31
|
+
let reach = () => {
|
|
32
|
+
el.scrollTop = start
|
|
33
|
+
if (el.scrollTop >= start) stop()
|
|
34
|
+
}
|
|
35
|
+
let grown = new MutationObserver(reach)
|
|
36
|
+
let stop = () => {
|
|
37
|
+
grown.disconnect()
|
|
38
|
+
clearTimeout(timer)
|
|
39
|
+
for (let type of ['wheel', 'touchstart', 'keydown']) {
|
|
40
|
+
el.removeEventListener(type, stop)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
let timer = setTimeout(stop, 2000)
|
|
44
|
+
grown.observe(el, { childList: true, subtree: true })
|
|
45
|
+
for (let type of ['wheel', 'touchstart', 'keydown']) {
|
|
46
|
+
el.addEventListener(type, stop)
|
|
47
|
+
}
|
|
48
|
+
return stop
|
|
49
|
+
}, [props.id])
|
|
50
|
+
return h('div', {
|
|
51
|
+
...props,
|
|
52
|
+
ref,
|
|
53
|
+
onScroll: onScroll &&
|
|
54
|
+
((e: Event) => onScroll((e.currentTarget as HTMLElement).scrollTop)),
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
export let installViewport = (body: FunctionComponent<ViewportProps>): void => {
|
|
58
|
+
Body = body
|
|
59
|
+
}
|
|
60
|
+
export let Viewport: FunctionComponent<ViewportProps> = (props) =>
|
|
61
|
+
h(Body, props)
|
package/wear-build.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// The stock Linen composition, served from the same package directory as its
|
|
2
|
+
// source sheets so each relative URL resolves exactly as it did before.
|
|
3
|
+
import { text } from 'jsr:@yaks/api@0.2.36/asset'
|
|
4
|
+
import { linenAddresses, linenAsset } from './kit.ts'
|
|
5
|
+
|
|
6
|
+
export let wearAssets = async (
|
|
7
|
+
read = text,
|
|
8
|
+
): Promise<Record<string, string>> => ({
|
|
9
|
+
[linenAsset]: (await Promise.all(
|
|
10
|
+
linenAddresses().map((href) => read(new URL(href))),
|
|
11
|
+
)).join('\n'),
|
|
12
|
+
})
|
package/wear.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dressing a browser page in a composition: its theme, what every theme
|
|
3
|
+
* derives, and each part's sheet, linked ahead of the page's own stylesheet,
|
|
4
|
+
* so the page, which sets its own colours and type in the theme's names
|
|
5
|
+
* (`--bg`, `--accent`, `--font`, `--size`), wins.
|
|
6
|
+
*
|
|
7
|
+
* ```ts ignore
|
|
8
|
+
* import { kits, themes } from '@yaks/ui/ui'
|
|
9
|
+
* import { wear } from '@yaks/ui/wear'
|
|
10
|
+
* await wear({ kits, theme: themes.linen }) // then render: nothing paints undressed
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/ import { addresses, kits, linenAddresses, linenAsset, themes } from "./kit.js";
|
|
15
|
+
import { linkSheet } from "./stock.js";
|
|
16
|
+
/** Link the sheets `c` dresses a page in (`addresses`), before the page's
|
|
17
|
+
* first stylesheet, settling once each has loaded or failed. */ export let wear = (c)=>wearIn(document, c);
|
|
18
|
+
// Compiled browser packages carry the kit beside the original CSS. Outside
|
|
19
|
+
// that catalog the original stylesheet URLs stand on their own.
|
|
20
|
+
let combined = (at, c, wanted)=>{
|
|
21
|
+
if (c.kits != kits || c.theme != themes.linen || c.skin) return;
|
|
22
|
+
let bundle = new URL(linenAsset, at);
|
|
23
|
+
if (!/^\/__packages\/[a-f0-9]{64}\/resources\//.test(bundle.pathname)) return;
|
|
24
|
+
let stock = linenAddresses();
|
|
25
|
+
if (stock.length == wanted.length && stock.every((href, i)=>wanted[i] == href)) {
|
|
26
|
+
return bundle.href;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
/** {@link wear} into a given document. A sheet already linked is left. */ export let wearIn = async (doc, c, moduleUrl = import.meta.url)=>{
|
|
30
|
+
let linked = new Set([
|
|
31
|
+
...doc.querySelectorAll('link[rel=stylesheet]')
|
|
32
|
+
].map((l)=>l.href));
|
|
33
|
+
let first = doc.querySelector('link[rel=stylesheet],style');
|
|
34
|
+
let wanted = addresses(c);
|
|
35
|
+
let bundle = combined(moduleUrl, c, wanted);
|
|
36
|
+
if (bundle && linked.has(bundle)) return;
|
|
37
|
+
if (bundle && wanted.every((href)=>!linked.has(href)) && await linkSheet(doc, first, bundle, true)) return;
|
|
38
|
+
await Promise.all(wanted.filter((href)=>!linked.has(href)).map((href)=>linkSheet(doc, first, href)));
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=wear.js.map
|
package/wear.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wear.js","sources":["./wear.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;CAaC,GAED,SAAS,SAAS,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,mBAAkB;AAE9E,SAAS,SAAS,qBAAoB;AAEtC;8DAC8D,GAC9D,OAAO,IAAI,OAAO,CAAC,IAAkC,OAAO,UAAU,GAAE;AAExE,2EAA2E;AAC3E,gEAAgE;AAChE,IAAI,WAAW,CACb,IACA,GACA;EAEA,IAAI,EAAE,IAAI,IAAI,QAAQ,EAAE,KAAK,IAAI,OAAO,KAAK,IAAI,EAAE,IAAI,EAAE;EACzD,IAAI,SAAS,IAAI,IAAI,YAAY;EACjC,IAAI,CAAC,2CAA2C,IAAI,CAAC,OAAO,QAAQ,GAAG;EACvE,IAAI,QAAQ;EACZ,IACE,MAAM,MAAM,IAAI,OAAO,MAAM,IAAI,MAAM,KAAK,CAAC,CAAC,MAAM,IAAM,MAAM,CAAC,EAAE,IAAI,OACvE;IACA,OAAO,OAAO,IAAI;EACpB;AACF;AAEA,wEAAwE,GACxE,OAAO,IAAI,SAAS,OAClB,KACA,GACA,YAAoB,YAAY,GAAG;EAEnC,IAAI,SAAS,IAAI,IACf;OAAI,IAAI,gBAAgB,CAAkB;GAAwB,CAC/D,GAAG,CAAC,CAAC,IAAM,EAAE,IAAI;EAEtB,IAAI,QAAQ,IAAI,aAAa,CAAC;EAC9B,IAAI,SAAS,UAAU;EACvB,IAAI,SAAS,SAAS,WAAW,GAAG;EACpC,IAAI,UAAU,OAAO,GAAG,CAAC,SAAS;EAClC,IACE,UAAU,OAAO,KAAK,CAAC,CAAC,OAAS,CAAC,OAAO,GAAG,CAAC,UAC7C,MAAM,UAAU,KAAK,OAAO,QAAQ,OACpC;EACF,MAAM,QAAQ,GAAG,CACf,OAAO,MAAM,CAAC,CAAC,OAAS,CAAC,OAAO,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,OAC9C,UAAU,KAAK,OAAO;AAG5B,EAAC"}
|
package/wear.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dressing a browser page in a composition: its theme, what every theme
|
|
3
|
+
* derives, and each part's sheet, linked ahead of the page's own stylesheet,
|
|
4
|
+
* so the page, which sets its own colours and type in the theme's names
|
|
5
|
+
* (`--bg`, `--accent`, `--font`, `--size`), wins.
|
|
6
|
+
*
|
|
7
|
+
* ```ts ignore
|
|
8
|
+
* import { kits, themes } from '@yaks/ui/ui'
|
|
9
|
+
* import { wear } from '@yaks/ui/wear'
|
|
10
|
+
* await wear({ kits, theme: themes.linen }) // then render: nothing paints undressed
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { addresses, kits, linenAddresses, linenAsset, themes } from './kit.js'
|
|
17
|
+
import type { Composition } from './theme.ts'
|
|
18
|
+
import { linkSheet } from './stock.js'
|
|
19
|
+
|
|
20
|
+
/** Link the sheets `c` dresses a page in (`addresses`), before the page's
|
|
21
|
+
* first stylesheet, settling once each has loaded or failed. */
|
|
22
|
+
export let wear = (c: Composition): Promise<void> => wearIn(document, c)
|
|
23
|
+
|
|
24
|
+
// Compiled browser packages carry the kit beside the original CSS. Outside
|
|
25
|
+
// that catalog the original stylesheet URLs stand on their own.
|
|
26
|
+
let combined = (
|
|
27
|
+
at: string,
|
|
28
|
+
c: Composition,
|
|
29
|
+
wanted: string[],
|
|
30
|
+
): string | undefined => {
|
|
31
|
+
if (c.kits != kits || c.theme != themes.linen || c.skin) return
|
|
32
|
+
let bundle = new URL(linenAsset, at)
|
|
33
|
+
if (!/^\/__packages\/[a-f0-9]{64}\/resources\//.test(bundle.pathname)) return
|
|
34
|
+
let stock = linenAddresses()
|
|
35
|
+
if (
|
|
36
|
+
stock.length == wanted.length && stock.every((href, i) => wanted[i] == href)
|
|
37
|
+
) {
|
|
38
|
+
return bundle.href
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** {@link wear} into a given document. A sheet already linked is left. */
|
|
43
|
+
export let wearIn = async (
|
|
44
|
+
doc: Document,
|
|
45
|
+
c: Composition,
|
|
46
|
+
moduleUrl: string = import.meta.url,
|
|
47
|
+
): Promise<void> => {
|
|
48
|
+
let linked = new Set(
|
|
49
|
+
[...doc.querySelectorAll<HTMLLinkElement>('link[rel=stylesheet]')]
|
|
50
|
+
.map((l) => l.href),
|
|
51
|
+
)
|
|
52
|
+
let first = doc.querySelector('link[rel=stylesheet],style')
|
|
53
|
+
let wanted = addresses(c)
|
|
54
|
+
let bundle = combined(moduleUrl, c, wanted)
|
|
55
|
+
if (bundle && linked.has(bundle)) return
|
|
56
|
+
if (
|
|
57
|
+
bundle && wanted.every((href) => !linked.has(href)) &&
|
|
58
|
+
await linkSheet(doc, first, bundle, true)
|
|
59
|
+
) return
|
|
60
|
+
await Promise.all(
|
|
61
|
+
wanted.filter((href) => !linked.has(href)).map((href) =>
|
|
62
|
+
linkSheet(doc, first, href)
|
|
63
|
+
),
|
|
64
|
+
)
|
|
65
|
+
}
|