@newtone-dev/ui-react-web 0.42.0 → 0.44.0
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/app-frame/app-frame.css +1026 -0
- package/dist/app-frame/app-frame.d.ts +62 -0
- package/dist/app-frame/app-frame.d.ts.map +1 -0
- package/dist/app-frame/app-frame.js +47 -0
- package/dist/app-frame/app-frame.js.map +1 -0
- package/dist/{desktop → app-frame}/control/control.d.ts +3 -2
- package/dist/app-frame/control/control.d.ts.map +1 -0
- package/dist/{desktop → app-frame}/control/control.js +6 -5
- package/dist/app-frame/control/control.js.map +1 -0
- package/dist/app-frame/index.d.ts +12 -0
- package/dist/app-frame/index.d.ts.map +1 -0
- package/dist/app-frame/index.js +4 -0
- package/dist/app-frame/index.js.map +1 -0
- package/dist/{desktop → app-frame}/launcher/launcher.d.ts +13 -9
- package/dist/app-frame/launcher/launcher.d.ts.map +1 -0
- package/dist/app-frame/launcher/launcher.js +166 -0
- package/dist/app-frame/launcher/launcher.js.map +1 -0
- package/dist/app-frame/main-menu/main-menu.d.ts +34 -0
- package/dist/app-frame/main-menu/main-menu.d.ts.map +1 -0
- package/dist/app-frame/main-menu/main-menu.js +185 -0
- package/dist/app-frame/main-menu/main-menu.js.map +1 -0
- package/dist/{desktop → app-frame}/menu/menu.d.ts +4 -3
- package/dist/app-frame/menu/menu.d.ts.map +1 -0
- package/dist/{desktop → app-frame}/menu/menu.js +6 -4
- package/dist/app-frame/menu/menu.js.map +1 -0
- package/dist/app-frame/monogram/monogram.d.ts.map +1 -0
- package/dist/app-frame/monogram/monogram.js +15 -0
- package/dist/app-frame/monogram/monogram.js.map +1 -0
- package/dist/{desktop → app-frame}/panel/panel.d.ts +3 -3
- package/dist/app-frame/panel/panel.d.ts.map +1 -0
- package/dist/{desktop → app-frame}/panel/panel.js +2 -2
- package/dist/app-frame/panel/panel.js.map +1 -0
- package/dist/app-frame/parts.d.ts +177 -0
- package/dist/app-frame/parts.d.ts.map +1 -0
- package/dist/app-frame/parts.js +119 -0
- package/dist/app-frame/parts.js.map +1 -0
- package/dist/{desktop → app-frame}/sheet/sheet.d.ts +3 -3
- package/dist/app-frame/sheet/sheet.d.ts.map +1 -0
- package/dist/app-frame/sheet/sheet.js +10 -0
- package/dist/app-frame/sheet/sheet.js.map +1 -0
- package/dist/{desktop → app-frame}/widget/widget.d.ts +8 -8
- package/dist/app-frame/widget/widget.d.ts.map +1 -0
- package/dist/app-frame/widget/widget.js +18 -0
- package/dist/app-frame/widget/widget.js.map +1 -0
- package/dist/ask-button/ask-button.css +37 -0
- package/dist/ask-button/ask-button.d.ts +24 -0
- package/dist/ask-button/ask-button.d.ts.map +1 -0
- package/dist/ask-button/ask-button.js +19 -0
- package/dist/ask-button/ask-button.js.map +1 -0
- package/dist/ask-button/index.d.ts +3 -0
- package/dist/ask-button/index.d.ts.map +1 -0
- package/dist/ask-button/index.js +2 -0
- package/dist/ask-button/index.js.map +1 -0
- package/dist/avatar/avatar.css +65 -0
- package/dist/avatar/avatar.d.ts +12 -1
- package/dist/avatar/avatar.d.ts.map +1 -1
- package/dist/avatar/avatar.js +3 -3
- package/dist/avatar/avatar.js.map +1 -1
- package/dist/backlinks/backlinks.css +6 -0
- package/dist/backlinks/backlinks.d.ts +28 -0
- package/dist/backlinks/backlinks.d.ts.map +1 -0
- package/dist/backlinks/backlinks.js +13 -0
- package/dist/backlinks/backlinks.js.map +1 -0
- package/dist/backlinks/index.d.ts +3 -0
- package/dist/backlinks/index.d.ts.map +1 -0
- package/dist/backlinks/index.js +2 -0
- package/dist/backlinks/index.js.map +1 -0
- package/dist/badge/badge.css +44 -0
- package/dist/badge/badge.d.ts +16 -0
- package/dist/badge/badge.d.ts.map +1 -0
- package/dist/badge/badge.js +15 -0
- package/dist/badge/badge.js.map +1 -0
- package/dist/badge/index.d.ts +3 -0
- package/dist/badge/index.d.ts.map +1 -0
- package/dist/badge/index.js +2 -0
- package/dist/badge/index.js.map +1 -0
- package/dist/below/below.css +214 -0
- package/dist/below/below.d.ts +61 -0
- package/dist/below/below.d.ts.map +1 -0
- package/dist/below/below.js +106 -0
- package/dist/below/below.js.map +1 -0
- package/dist/below/grip.d.ts +20 -0
- package/dist/below/grip.d.ts.map +1 -0
- package/dist/below/grip.js +78 -0
- package/dist/below/grip.js.map +1 -0
- package/dist/below/index.d.ts +3 -0
- package/dist/below/index.d.ts.map +1 -0
- package/dist/below/index.js +2 -0
- package/dist/below/index.js.map +1 -0
- package/dist/below/room.d.ts +2 -0
- package/dist/below/room.d.ts.map +1 -0
- package/dist/below/room.js +6 -0
- package/dist/below/room.js.map +1 -0
- package/dist/beside/beside.css +68 -4
- package/dist/beside/beside.d.ts +8 -1
- package/dist/beside/beside.d.ts.map +1 -1
- package/dist/beside/beside.js +2 -2
- package/dist/beside/beside.js.map +1 -1
- package/dist/canvas/box/box.d.ts +9 -2
- package/dist/canvas/box/box.d.ts.map +1 -1
- package/dist/canvas/box/box.js +8 -4
- package/dist/canvas/box/box.js.map +1 -1
- package/dist/canvas/canvas.css +411 -8
- package/dist/canvas/canvas.d.ts +57 -8
- package/dist/canvas/canvas.d.ts.map +1 -1
- package/dist/canvas/canvas.js +166 -13
- package/dist/canvas/canvas.js.map +1 -1
- package/dist/canvas/cells/cells.d.ts +17 -0
- package/dist/canvas/cells/cells.d.ts.map +1 -0
- package/dist/canvas/cells/cells.js +24 -0
- package/dist/canvas/cells/cells.js.map +1 -0
- package/dist/canvas/cells/grid.d.ts +84 -0
- package/dist/canvas/cells/grid.d.ts.map +1 -0
- package/dist/canvas/cells/grid.js +170 -0
- package/dist/canvas/cells/grid.js.map +1 -0
- package/dist/canvas/context.d.ts +16 -0
- package/dist/canvas/context.d.ts.map +1 -1
- package/dist/canvas/context.js.map +1 -1
- package/dist/canvas/dock/dock.d.ts +25 -0
- package/dist/canvas/dock/dock.d.ts.map +1 -0
- package/dist/canvas/dock/dock.js +60 -0
- package/dist/canvas/dock/dock.js.map +1 -0
- package/dist/canvas/edit/edit.d.ts +40 -0
- package/dist/canvas/edit/edit.d.ts.map +1 -0
- package/dist/canvas/edit/edit.js +66 -0
- package/dist/canvas/edit/edit.js.map +1 -0
- package/dist/canvas/edit/rich.d.ts +105 -0
- package/dist/canvas/edit/rich.d.ts.map +1 -0
- package/dist/canvas/edit/rich.js +694 -0
- package/dist/canvas/edit/rich.js.map +1 -0
- package/dist/canvas/frame/frame.d.ts +15 -4
- package/dist/canvas/frame/frame.d.ts.map +1 -1
- package/dist/canvas/frame/frame.js +20 -8
- package/dist/canvas/frame/frame.js.map +1 -1
- package/dist/canvas/heading/heading.d.ts +17 -0
- package/dist/canvas/heading/heading.d.ts.map +1 -0
- package/dist/canvas/heading/heading.js +18 -0
- package/dist/canvas/heading/heading.js.map +1 -0
- package/dist/canvas/index.d.ts +13 -1
- package/dist/canvas/index.d.ts.map +1 -1
- package/dist/canvas/index.js +2 -0
- package/dist/canvas/index.js.map +1 -1
- package/dist/canvas/insert/insert.d.ts +18 -0
- package/dist/canvas/insert/insert.d.ts.map +1 -0
- package/dist/canvas/insert/insert.js +40 -0
- package/dist/canvas/insert/insert.js.map +1 -0
- package/dist/canvas/mark/mark.d.ts +24 -0
- package/dist/canvas/mark/mark.d.ts.map +1 -0
- package/dist/canvas/mark/mark.js +20 -0
- package/dist/canvas/mark/mark.js.map +1 -0
- package/dist/canvas/pin/pin.d.ts +24 -0
- package/dist/canvas/pin/pin.d.ts.map +1 -0
- package/dist/canvas/pin/pin.js +52 -0
- package/dist/canvas/pin/pin.js.map +1 -0
- package/dist/canvas/presence/presence.d.ts +16 -0
- package/dist/canvas/presence/presence.d.ts.map +1 -0
- package/dist/canvas/presence/presence.js +14 -0
- package/dist/canvas/presence/presence.js.map +1 -0
- package/dist/card-box/card-box.css +8 -8
- package/dist/card-box/card-box.d.ts +1 -1
- package/dist/card-box/card-box.d.ts.map +1 -1
- package/dist/chat/chat.css +2 -7
- package/dist/chat/chat.d.ts +5 -3
- package/dist/chat/chat.d.ts.map +1 -1
- package/dist/chat/chat.js +17 -24
- package/dist/chat/chat.js.map +1 -1
- package/dist/color/seeds.js +2 -2
- package/dist/color/seeds.js.map +1 -1
- package/dist/data-grid/data-grid.css +128 -0
- package/dist/data-grid/data-grid.d.ts +45 -0
- package/dist/data-grid/data-grid.d.ts.map +1 -0
- package/dist/data-grid/data-grid.js +50 -0
- package/dist/data-grid/data-grid.js.map +1 -0
- package/dist/data-grid/index.d.ts +3 -0
- package/dist/data-grid/index.d.ts.map +1 -0
- package/dist/data-grid/index.js +2 -0
- package/dist/data-grid/index.js.map +1 -0
- package/dist/discover/discover.css +60 -0
- package/dist/discover/discover.d.ts +33 -0
- package/dist/discover/discover.d.ts.map +1 -0
- package/dist/discover/discover.js +13 -0
- package/dist/discover/discover.js.map +1 -0
- package/dist/discover/index.d.ts +4 -0
- package/dist/discover/index.d.ts.map +1 -0
- package/dist/discover/index.js +3 -0
- package/dist/discover/index.js.map +1 -0
- package/dist/document/document.css +74 -0
- package/dist/document/document.d.ts +31 -0
- package/dist/document/document.d.ts.map +1 -0
- package/dist/document/document.js +106 -0
- package/dist/document/document.js.map +1 -0
- package/dist/document/index.d.ts +5 -0
- package/dist/document/index.d.ts.map +1 -0
- package/dist/document/index.js +3 -0
- package/dist/document/index.js.map +1 -0
- package/dist/document/wiki-links.d.ts +29 -0
- package/dist/document/wiki-links.d.ts.map +1 -0
- package/dist/document/wiki-links.js +66 -0
- package/dist/document/wiki-links.js.map +1 -0
- package/dist/faces/faces.css +82 -0
- package/dist/faces/faces.d.ts +29 -0
- package/dist/faces/faces.d.ts.map +1 -0
- package/dist/faces/faces.js +21 -0
- package/dist/faces/faces.js.map +1 -0
- package/dist/faces/index.d.ts +4 -0
- package/dist/faces/index.d.ts.map +1 -0
- package/dist/faces/index.js +3 -0
- package/dist/faces/index.js.map +1 -0
- package/dist/file-grid/file-grid.css +56 -1
- package/dist/file-grid/file-grid.d.ts +39 -4
- package/dist/file-grid/file-grid.d.ts.map +1 -1
- package/dist/file-grid/file-grid.js +45 -5
- package/dist/file-grid/file-grid.js.map +1 -1
- package/dist/file-grid/index.d.ts +1 -1
- package/dist/file-grid/index.d.ts.map +1 -1
- package/dist/floating-bar/floating-bar.css +379 -0
- package/dist/floating-bar/floating-bar.d.ts +186 -0
- package/dist/floating-bar/floating-bar.d.ts.map +1 -0
- package/dist/floating-bar/floating-bar.js +278 -0
- package/dist/floating-bar/floating-bar.js.map +1 -0
- package/dist/floating-bar/index.d.ts +3 -0
- package/dist/floating-bar/index.d.ts.map +1 -0
- package/dist/floating-bar/index.js +2 -0
- package/dist/floating-bar/index.js.map +1 -0
- package/dist/floating-bar/menu.d.ts +59 -0
- package/dist/floating-bar/menu.d.ts.map +1 -0
- package/dist/floating-bar/menu.js +149 -0
- package/dist/floating-bar/menu.js.map +1 -0
- package/dist/floating-bar/room.d.ts +2 -0
- package/dist/floating-bar/room.d.ts.map +1 -0
- package/dist/floating-bar/room.js +5 -0
- package/dist/floating-bar/room.js.map +1 -0
- package/dist/font-picker/font-picker.css +39 -0
- package/dist/font-picker/font-picker.d.ts +29 -0
- package/dist/font-picker/font-picker.d.ts.map +1 -0
- package/dist/font-picker/font-picker.js +119 -0
- package/dist/font-picker/font-picker.js.map +1 -0
- package/dist/font-picker/index.d.ts +3 -0
- package/dist/font-picker/index.d.ts.map +1 -0
- package/dist/font-picker/index.js +2 -0
- package/dist/font-picker/index.js.map +1 -0
- package/dist/framed-icon/framed-icon.css +18 -18
- package/dist/framed-icon/framed-icon.d.ts +1 -1
- package/dist/framed-icon/framed-icon.d.ts.map +1 -1
- package/dist/hint/hint.css +55 -0
- package/dist/hint/hint.d.ts +33 -0
- package/dist/hint/hint.d.ts.map +1 -0
- package/dist/hint/hint.js +80 -0
- package/dist/hint/hint.js.map +1 -0
- package/dist/hint/index.d.ts +4 -0
- package/dist/hint/index.d.ts.map +1 -0
- package/dist/hint/index.js +3 -0
- package/dist/hint/index.js.map +1 -0
- package/dist/index.d.ts +59 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -2
- package/dist/index.js.map +1 -1
- package/dist/inspector/index.d.ts +3 -0
- package/dist/inspector/index.d.ts.map +1 -0
- package/dist/inspector/index.js +2 -0
- package/dist/inspector/index.js.map +1 -0
- package/dist/inspector/inspector.css +219 -0
- package/dist/inspector/inspector.d.ts +131 -0
- package/dist/inspector/inspector.d.ts.map +1 -0
- package/dist/inspector/inspector.js +68 -0
- package/dist/inspector/inspector.js.map +1 -0
- package/dist/look-picker/index.d.ts +3 -0
- package/dist/look-picker/index.d.ts.map +1 -0
- package/dist/look-picker/index.js +2 -0
- package/dist/look-picker/index.js.map +1 -0
- package/dist/look-picker/look-picker.css +90 -0
- package/dist/look-picker/look-picker.d.ts +40 -0
- package/dist/look-picker/look-picker.d.ts.map +1 -0
- package/dist/look-picker/look-picker.js +82 -0
- package/dist/look-picker/look-picker.js.map +1 -0
- package/dist/look-thumb/index.d.ts +3 -0
- package/dist/look-thumb/index.d.ts.map +1 -0
- package/dist/look-thumb/index.js +2 -0
- package/dist/look-thumb/index.js.map +1 -0
- package/dist/look-thumb/look-thumb.css +7 -0
- package/dist/look-thumb/look-thumb.d.ts +27 -0
- package/dist/look-thumb/look-thumb.d.ts.map +1 -0
- package/dist/look-thumb/look-thumb.js +15 -0
- package/dist/look-thumb/look-thumb.js.map +1 -0
- package/dist/material/index.d.ts +3 -0
- package/dist/material/index.d.ts.map +1 -0
- package/dist/material/index.js +2 -0
- package/dist/material/index.js.map +1 -0
- package/dist/material/material.css +306 -0
- package/dist/material/material.d.ts +43 -0
- package/dist/material/material.d.ts.map +1 -0
- package/dist/material/material.js +27 -0
- package/dist/material/material.js.map +1 -0
- package/dist/on-media/on-media.css +6 -6
- package/dist/page-editor/blocks.d.ts +28 -0
- package/dist/page-editor/blocks.d.ts.map +1 -0
- package/dist/page-editor/blocks.js +206 -0
- package/dist/page-editor/blocks.js.map +1 -0
- package/dist/page-editor/index.d.ts +5 -0
- package/dist/page-editor/index.d.ts.map +1 -0
- package/dist/page-editor/index.js +3 -0
- package/dist/page-editor/index.js.map +1 -0
- package/dist/page-editor/page-editor.css +160 -0
- package/dist/page-editor/page-editor.d.ts +52 -0
- package/dist/page-editor/page-editor.d.ts.map +1 -0
- package/dist/page-editor/page-editor.js +474 -0
- package/dist/page-editor/page-editor.js.map +1 -0
- package/dist/prompt-field/index.d.ts +3 -0
- package/dist/prompt-field/index.d.ts.map +1 -0
- package/dist/prompt-field/index.js +2 -0
- package/dist/prompt-field/index.js.map +1 -0
- package/dist/prompt-field/prompt-field.css +203 -0
- package/dist/prompt-field/prompt-field.d.ts +72 -0
- package/dist/prompt-field/prompt-field.d.ts.map +1 -0
- package/dist/prompt-field/prompt-field.js +91 -0
- package/dist/prompt-field/prompt-field.js.map +1 -0
- package/dist/quick-action/index.d.ts +1 -1
- package/dist/quick-action/index.d.ts.map +1 -1
- package/dist/quick-action/quick-action.css +60 -17
- package/dist/quick-action/quick-action.d.ts +34 -28
- package/dist/quick-action/quick-action.d.ts.map +1 -1
- package/dist/quick-action/quick-action.js +25 -21
- package/dist/quick-action/quick-action.js.map +1 -1
- package/dist/row-list/row-list.css +3 -0
- package/dist/seed-color-field/index.d.ts +3 -0
- package/dist/seed-color-field/index.d.ts.map +1 -0
- package/dist/seed-color-field/index.js +2 -0
- package/dist/seed-color-field/index.js.map +1 -0
- package/dist/seed-color-field/seed-color-field.css +105 -0
- package/dist/seed-color-field/seed-color-field.d.ts +36 -0
- package/dist/seed-color-field/seed-color-field.d.ts.map +1 -0
- package/dist/seed-color-field/seed-color-field.js +103 -0
- package/dist/seed-color-field/seed-color-field.js.map +1 -0
- package/dist/skeleton/index.d.ts +3 -0
- package/dist/skeleton/index.d.ts.map +1 -0
- package/dist/skeleton/index.js +2 -0
- package/dist/skeleton/index.js.map +1 -0
- package/dist/skeleton/skeleton.css +84 -0
- package/dist/skeleton/skeleton.d.ts +50 -0
- package/dist/skeleton/skeleton.d.ts.map +1 -0
- package/dist/skeleton/skeleton.js +25 -0
- package/dist/skeleton/skeleton.js.map +1 -0
- package/dist/slide-list/index.d.ts +3 -0
- package/dist/slide-list/index.d.ts.map +1 -0
- package/dist/slide-list/index.js +2 -0
- package/dist/slide-list/index.js.map +1 -0
- package/dist/slide-list/slide-list.css +477 -0
- package/dist/slide-list/slide-list.d.ts +161 -0
- package/dist/slide-list/slide-list.d.ts.map +1 -0
- package/dist/slide-list/slide-list.js +657 -0
- package/dist/slide-list/slide-list.js.map +1 -0
- package/dist/split/index.d.ts +1 -1
- package/dist/split/index.d.ts.map +1 -1
- package/dist/split/split.css +396 -0
- package/dist/split/split.d.ts +60 -1
- package/dist/split/split.d.ts.map +1 -1
- package/dist/split/split.js +30 -3
- package/dist/split/split.js.map +1 -1
- package/dist/stage/index.d.ts +3 -0
- package/dist/stage/index.d.ts.map +1 -0
- package/dist/stage/index.js +2 -0
- package/dist/stage/index.js.map +1 -0
- package/dist/stage/stage.css +139 -0
- package/dist/stage/stage.d.ts +68 -0
- package/dist/stage/stage.d.ts.map +1 -0
- package/dist/stage/stage.js +279 -0
- package/dist/stage/stage.js.map +1 -0
- package/dist/text-diff/diff-lines.d.ts +23 -0
- package/dist/text-diff/diff-lines.d.ts.map +1 -0
- package/dist/text-diff/diff-lines.js +105 -0
- package/dist/text-diff/diff-lines.js.map +1 -0
- package/dist/text-diff/index.d.ts +5 -0
- package/dist/text-diff/index.d.ts.map +1 -0
- package/dist/text-diff/index.js +3 -0
- package/dist/text-diff/index.js.map +1 -0
- package/dist/text-diff/text-diff.css +60 -0
- package/dist/text-diff/text-diff.d.ts +26 -0
- package/dist/text-diff/text-diff.d.ts.map +1 -0
- package/dist/text-diff/text-diff.js +27 -0
- package/dist/text-diff/text-diff.js.map +1 -0
- package/dist/thread/index.d.ts +3 -0
- package/dist/thread/index.d.ts.map +1 -0
- package/dist/thread/index.js +2 -0
- package/dist/thread/index.js.map +1 -0
- package/dist/thread/thread.css +178 -0
- package/dist/thread/thread.d.ts +76 -0
- package/dist/thread/thread.d.ts.map +1 -0
- package/dist/thread/thread.js +147 -0
- package/dist/thread/thread.js.map +1 -0
- package/dist/tile-picker/index.d.ts +3 -0
- package/dist/tile-picker/index.d.ts.map +1 -0
- package/dist/tile-picker/index.js +2 -0
- package/dist/tile-picker/index.js.map +1 -0
- package/dist/tile-picker/tile-picker.css +93 -0
- package/dist/tile-picker/tile-picker.d.ts +37 -0
- package/dist/tile-picker/tile-picker.d.ts.map +1 -0
- package/dist/tile-picker/tile-picker.js +62 -0
- package/dist/tile-picker/tile-picker.js.map +1 -0
- package/dist/version-trail/index.d.ts +3 -0
- package/dist/version-trail/index.d.ts.map +1 -0
- package/dist/version-trail/index.js +2 -0
- package/dist/version-trail/index.js.map +1 -0
- package/dist/version-trail/version-trail.css +62 -0
- package/dist/version-trail/version-trail.d.ts +38 -0
- package/dist/version-trail/version-trail.d.ts.map +1 -0
- package/dist/version-trail/version-trail.js +22 -0
- package/dist/version-trail/version-trail.js.map +1 -0
- package/dist/workbench/index.d.ts +3 -0
- package/dist/workbench/index.d.ts.map +1 -0
- package/dist/workbench/index.js +2 -0
- package/dist/workbench/index.js.map +1 -0
- package/dist/workbench/workbench.css +248 -0
- package/dist/workbench/workbench.d.ts +51 -0
- package/dist/workbench/workbench.d.ts.map +1 -0
- package/dist/workbench/workbench.js +13 -0
- package/dist/workbench/workbench.js.map +1 -0
- package/package.json +133 -7
- package/dist/desktop/bar/apps.d.ts +0 -18
- package/dist/desktop/bar/apps.d.ts.map +0 -1
- package/dist/desktop/bar/apps.js +0 -16
- package/dist/desktop/bar/apps.js.map +0 -1
- package/dist/desktop/bar/bar.d.ts +0 -56
- package/dist/desktop/bar/bar.d.ts.map +0 -1
- package/dist/desktop/bar/bar.js +0 -34
- package/dist/desktop/bar/bar.js.map +0 -1
- package/dist/desktop/bar/monogram.d.ts.map +0 -1
- package/dist/desktop/bar/monogram.js +0 -15
- package/dist/desktop/bar/monogram.js.map +0 -1
- package/dist/desktop/context.d.ts +0 -17
- package/dist/desktop/context.d.ts.map +0 -1
- package/dist/desktop/context.js +0 -10
- package/dist/desktop/context.js.map +0 -1
- package/dist/desktop/control/control.d.ts.map +0 -1
- package/dist/desktop/control/control.js.map +0 -1
- package/dist/desktop/desktop.css +0 -1058
- package/dist/desktop/desktop.d.ts +0 -72
- package/dist/desktop/desktop.d.ts.map +0 -1
- package/dist/desktop/desktop.js +0 -70
- package/dist/desktop/desktop.js.map +0 -1
- package/dist/desktop/index.d.ts +0 -16
- package/dist/desktop/index.d.ts.map +0 -1
- package/dist/desktop/index.js +0 -5
- package/dist/desktop/index.js.map +0 -1
- package/dist/desktop/launcher/launcher.d.ts.map +0 -1
- package/dist/desktop/launcher/launcher.js +0 -164
- package/dist/desktop/launcher/launcher.js.map +0 -1
- package/dist/desktop/menu/menu.d.ts.map +0 -1
- package/dist/desktop/menu/menu.js.map +0 -1
- package/dist/desktop/panel/panel.d.ts.map +0 -1
- package/dist/desktop/panel/panel.js.map +0 -1
- package/dist/desktop/profile/profile.d.ts +0 -38
- package/dist/desktop/profile/profile.d.ts.map +0 -1
- package/dist/desktop/profile/profile.js +0 -18
- package/dist/desktop/profile/profile.js.map +0 -1
- package/dist/desktop/sheet/sheet.d.ts.map +0 -1
- package/dist/desktop/sheet/sheet.js +0 -10
- package/dist/desktop/sheet/sheet.js.map +0 -1
- package/dist/desktop/tiles/layout.d.ts +0 -86
- package/dist/desktop/tiles/layout.d.ts.map +0 -1
- package/dist/desktop/tiles/layout.js +0 -215
- package/dist/desktop/tiles/layout.js.map +0 -1
- package/dist/desktop/tiles/tiles.d.ts +0 -106
- package/dist/desktop/tiles/tiles.d.ts.map +0 -1
- package/dist/desktop/tiles/tiles.js +0 -121
- package/dist/desktop/tiles/tiles.js.map +0 -1
- package/dist/desktop/widget/widget.d.ts.map +0 -1
- package/dist/desktop/widget/widget.js +0 -18
- package/dist/desktop/widget/widget.js.map +0 -1
- /package/dist/{desktop/bar → app-frame/monogram}/monogram.d.ts +0 -0
|
@@ -0,0 +1,694 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useImperativeHandle, useLayoutEffect, useRef } from 'react';
|
|
4
|
+
import { useCanvas } from '../context.js';
|
|
5
|
+
/**
|
|
6
|
+
* How far in a list item's words start, in ems of the field's size: its marker at the edge, every line of its words in
|
|
7
|
+
* by this much. The consumer that draws the same words keeps the same, so typing and drawn agree.
|
|
8
|
+
*/
|
|
9
|
+
export const CANVAS_EDIT_INDENT = { bullet: 1.1, number: 1.6 };
|
|
10
|
+
// --- Words as the field says them ----------------------------------------------------------------------------------
|
|
11
|
+
const LOOKS = ['bold', 'italic', 'size', 'font', 'color', 'href'];
|
|
12
|
+
const same = (a, b) => LOOKS.every((k) => (a[k] ?? null) === (b[k] ?? null));
|
|
13
|
+
const cleanRun = (r) => {
|
|
14
|
+
// Spaces alone take no bold or slant; a look that is off is left out.
|
|
15
|
+
const plain = !r.text.trim() && !r.href;
|
|
16
|
+
const out = { text: r.text };
|
|
17
|
+
if (r.bold && !plain)
|
|
18
|
+
out.bold = true;
|
|
19
|
+
if (r.italic && !plain)
|
|
20
|
+
out.italic = true;
|
|
21
|
+
if (r.size && r.size > 0)
|
|
22
|
+
out.size = Math.round(r.size);
|
|
23
|
+
if (r.font)
|
|
24
|
+
out.font = r.font;
|
|
25
|
+
if (r.color)
|
|
26
|
+
out.color = r.color;
|
|
27
|
+
if (r.href)
|
|
28
|
+
out.href = r.href;
|
|
29
|
+
return out;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Words as the field says them: runs that look alike joined, empty ones gone, a numbered list counted on from its
|
|
33
|
+
* first item, at least one paragraph. The same words always come out the same.
|
|
34
|
+
*/
|
|
35
|
+
export function normalizeParagraphs(value) {
|
|
36
|
+
const out = [];
|
|
37
|
+
for (const p of value) {
|
|
38
|
+
const runs = [];
|
|
39
|
+
for (const r of p.runs.map(cleanRun)) {
|
|
40
|
+
if (!r.text)
|
|
41
|
+
continue;
|
|
42
|
+
const last = runs[runs.length - 1];
|
|
43
|
+
if (last && same(last, r))
|
|
44
|
+
runs[runs.length - 1] = { ...last, text: last.text + r.text };
|
|
45
|
+
else
|
|
46
|
+
runs.push(r);
|
|
47
|
+
}
|
|
48
|
+
const prev = out[out.length - 1];
|
|
49
|
+
const n = p.list === 'number' ? (prev?.list === 'number' ? (prev.n ?? 1) + 1 : Math.max(1, p.n ?? 1)) : undefined;
|
|
50
|
+
out.push({ list: p.list, ...(n ? { n } : {}), ...(p.align ? { align: p.align } : {}), runs });
|
|
51
|
+
}
|
|
52
|
+
return out.length ? out : [{ list: null, runs: [] }];
|
|
53
|
+
}
|
|
54
|
+
const escape = (s) => s.replace(/[&<>"]/g, (c) => `&#${c.charCodeAt(0)};`);
|
|
55
|
+
const runHtml = (r, maps) => {
|
|
56
|
+
let h = escape(r.text);
|
|
57
|
+
if (r.italic)
|
|
58
|
+
h = `<i>${h}</i>`;
|
|
59
|
+
if (r.bold)
|
|
60
|
+
h = `<b>${h}</b>`;
|
|
61
|
+
if (r.href)
|
|
62
|
+
h = `<a href="${escape(r.href)}">${h}</a>`;
|
|
63
|
+
if (r.size || r.font || r.color) {
|
|
64
|
+
const style = [
|
|
65
|
+
r.size ? `font-size: calc(var(--newtone-edit-k) * ${r.size}px)` : '',
|
|
66
|
+
r.font && maps.fonts[r.font] ? `font-family: ${maps.fonts[r.font]}` : '',
|
|
67
|
+
r.color && maps.colors[r.color] ? `color: ${maps.colors[r.color]}` : '',
|
|
68
|
+
].filter(Boolean).join('; ');
|
|
69
|
+
const data = [r.size ? `data-size="${r.size}"` : '', r.font ? `data-font="${escape(r.font)}"` : '', r.color ? `data-color="${escape(r.color)}"` : ''].filter(Boolean).join(' ');
|
|
70
|
+
h = `<span ${data} style="${escape(style)}">${h}</span>`;
|
|
71
|
+
}
|
|
72
|
+
return h;
|
|
73
|
+
};
|
|
74
|
+
const lineHtml = (p, maps) => p.runs.map((r) => runHtml(r, maps)).join('') || '<br>';
|
|
75
|
+
function htmlOf(value, maps) {
|
|
76
|
+
let h = '';
|
|
77
|
+
let open = null;
|
|
78
|
+
for (const p of value) {
|
|
79
|
+
if (p.list !== open) {
|
|
80
|
+
if (open)
|
|
81
|
+
h += open === 'bullet' ? '</ul>' : '</ol>';
|
|
82
|
+
if (p.list === 'bullet')
|
|
83
|
+
h += '<ul>';
|
|
84
|
+
else if (p.list === 'number')
|
|
85
|
+
h += `<ol start="${p.n ?? 1}" style="counter-reset: newtone-edit-n ${(p.n ?? 1) - 1}">`;
|
|
86
|
+
open = p.list;
|
|
87
|
+
}
|
|
88
|
+
const at = p.align ? ` data-align="${p.align}" style="text-align: ${p.align}"` : '';
|
|
89
|
+
h += p.list ? `<li${at}>${lineHtml(p, maps)}</li>` : `<div${at}>${lineHtml(p, maps)}</div>`;
|
|
90
|
+
}
|
|
91
|
+
if (open)
|
|
92
|
+
h += open === 'bullet' ? '</ul>' : '</ol>';
|
|
93
|
+
return h;
|
|
94
|
+
}
|
|
95
|
+
// Colours and families as the browser says them, to know them by their names again.
|
|
96
|
+
let probe = null;
|
|
97
|
+
const said = (prop, value) => {
|
|
98
|
+
if (typeof document === 'undefined')
|
|
99
|
+
return value;
|
|
100
|
+
probe ??= Object.assign(document.createElement('span'), { hidden: true });
|
|
101
|
+
if (!probe.isConnected)
|
|
102
|
+
document.body.append(probe);
|
|
103
|
+
probe.style[prop] = '';
|
|
104
|
+
probe.style[prop] = value;
|
|
105
|
+
return prop === 'color' ? getComputedStyle(probe).color : probe.style.fontFamily;
|
|
106
|
+
};
|
|
107
|
+
const nameOf = (map, prop, value) => {
|
|
108
|
+
if (!value)
|
|
109
|
+
return undefined;
|
|
110
|
+
const want = said(prop, value);
|
|
111
|
+
return Object.keys(map).find((k) => said(prop, map[k]) === want);
|
|
112
|
+
};
|
|
113
|
+
/** How one element of the field looks of its own: by what the field wrote on it, else by its style or tag. */
|
|
114
|
+
function lookOfElement(el, k, maps) {
|
|
115
|
+
const out = {};
|
|
116
|
+
const tag = el.tagName;
|
|
117
|
+
const style = el.style;
|
|
118
|
+
if (tag === 'B' || tag === 'STRONG' || style.fontWeight === 'bold' || Number(style.fontWeight) >= 600)
|
|
119
|
+
out.bold = true;
|
|
120
|
+
if (style.fontWeight === 'normal' || (Number(style.fontWeight) > 0 && Number(style.fontWeight) < 600))
|
|
121
|
+
out.bold = false;
|
|
122
|
+
if (tag === 'I' || tag === 'EM' || style.fontStyle === 'italic')
|
|
123
|
+
out.italic = true;
|
|
124
|
+
if (style.fontStyle === 'normal')
|
|
125
|
+
out.italic = false;
|
|
126
|
+
if (tag === 'A' && el.getAttribute('href'))
|
|
127
|
+
out.href = el.getAttribute('href');
|
|
128
|
+
const size = Number(el.dataset.size) || Number(/\*\s*([\d.]+)px\)/.exec(style.fontSize)?.[1]) || (/^[\d.]+px$/.test(style.fontSize) ? parseFloat(style.fontSize) / k : 0);
|
|
129
|
+
if (size > 0)
|
|
130
|
+
out.size = Math.round(size);
|
|
131
|
+
const font = el.dataset.font ?? (style.fontFamily ? nameOf(maps.fonts, 'fontFamily', style.fontFamily) : undefined);
|
|
132
|
+
if (font)
|
|
133
|
+
out.font = font;
|
|
134
|
+
const color = el.dataset.color ?? (style.color ? nameOf(maps.colors, 'color', style.color) : undefined);
|
|
135
|
+
if (color)
|
|
136
|
+
out.color = color;
|
|
137
|
+
return out;
|
|
138
|
+
}
|
|
139
|
+
const BLOCKS = new Set(['DIV', 'P', 'LI', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'BLOCKQUOTE', 'PRE']);
|
|
140
|
+
const alignOf = (el) => {
|
|
141
|
+
const a = el.dataset.align ?? el.style.textAlign;
|
|
142
|
+
return a === 'center' ? 'center' : a === 'end' || a === 'right' ? 'end' : a === 'start' || a === 'left' ? 'start' : undefined;
|
|
143
|
+
};
|
|
144
|
+
/** What the field holds, as paragraphs: whatever the browser made of the typing, read for every look and lists. */
|
|
145
|
+
function readField(root, k, maps) {
|
|
146
|
+
const out = [];
|
|
147
|
+
let cur = null;
|
|
148
|
+
// A numbered item's number, and a line's align, for the paragraph it begins.
|
|
149
|
+
let first;
|
|
150
|
+
let aligned;
|
|
151
|
+
const begin = (list) => {
|
|
152
|
+
const n = list === 'number' ? first : undefined;
|
|
153
|
+
first = undefined;
|
|
154
|
+
const p = { list, ...(n ? { n } : {}), ...(aligned ? { align: aligned } : {}), runs: [] };
|
|
155
|
+
cur = p;
|
|
156
|
+
out.push(p);
|
|
157
|
+
return p;
|
|
158
|
+
};
|
|
159
|
+
const para = (list) => cur ?? begin(list);
|
|
160
|
+
const walk = (node, fmt, list) => {
|
|
161
|
+
node.childNodes.forEach((child, i) => {
|
|
162
|
+
if (child.nodeType === Node.TEXT_NODE) {
|
|
163
|
+
const text = (child.nodeValue ?? '').replace(/ /g, ' ').replace(/[\r\n]+/g, ' ');
|
|
164
|
+
if (!text)
|
|
165
|
+
return;
|
|
166
|
+
para(list).runs.push({ text, ...fmt });
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
if (!(child instanceof HTMLElement))
|
|
170
|
+
return;
|
|
171
|
+
const tag = child.tagName;
|
|
172
|
+
if (tag === 'BR') {
|
|
173
|
+
// The browser's placeholder in an empty line is no new line; any other is.
|
|
174
|
+
const rest = [...node.childNodes].slice(i + 1).some((x) => x.nodeType !== Node.TEXT_NODE || x.nodeValue);
|
|
175
|
+
if (rest)
|
|
176
|
+
begin(list);
|
|
177
|
+
else
|
|
178
|
+
para(list);
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
if (tag === 'UL' || tag === 'OL') {
|
|
182
|
+
const kind = tag === 'UL' ? 'bullet' : 'number';
|
|
183
|
+
let n = Number(child.getAttribute('start')) || 1;
|
|
184
|
+
for (const li of child.children) {
|
|
185
|
+
if (!(li instanceof HTMLElement) || li.tagName !== 'LI')
|
|
186
|
+
continue;
|
|
187
|
+
// An item, or the lines the browser put in it; at least one, empty or not.
|
|
188
|
+
const before = out.length;
|
|
189
|
+
const was = aligned;
|
|
190
|
+
aligned = alignOf(li) ?? aligned;
|
|
191
|
+
cur = null;
|
|
192
|
+
first = kind === 'number' ? n++ : undefined;
|
|
193
|
+
walk(li, fmt, kind);
|
|
194
|
+
if (out.length === before)
|
|
195
|
+
begin(kind);
|
|
196
|
+
first = undefined;
|
|
197
|
+
aligned = was;
|
|
198
|
+
cur = null;
|
|
199
|
+
}
|
|
200
|
+
cur = null;
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
const next = { ...fmt, ...lookOfElement(child, k, maps) };
|
|
204
|
+
if (BLOCKS.has(tag)) {
|
|
205
|
+
// A line of its own; one the browser wraps round a list is only the list, and an empty one is an
|
|
206
|
+
// empty line.
|
|
207
|
+
const before = out.length;
|
|
208
|
+
const was = aligned;
|
|
209
|
+
aligned = alignOf(child) ?? aligned;
|
|
210
|
+
cur = null;
|
|
211
|
+
walk(child, next, list);
|
|
212
|
+
if (out.length === before)
|
|
213
|
+
begin(list);
|
|
214
|
+
aligned = was;
|
|
215
|
+
cur = null;
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
walk(child, next, list);
|
|
219
|
+
});
|
|
220
|
+
};
|
|
221
|
+
walk(root, {}, null);
|
|
222
|
+
return normalizeParagraphs(out);
|
|
223
|
+
}
|
|
224
|
+
const START = '';
|
|
225
|
+
const END = '';
|
|
226
|
+
const lengthOf = (p) => p.runs.reduce((n, r) => n + r.text.length, 0);
|
|
227
|
+
const collapsed = (m) => m.a.p === m.b.p && m.a.o === m.b.o;
|
|
228
|
+
const touches = (m) => (i) => i >= m.a.p && i <= m.b.p;
|
|
229
|
+
/** The runs of paragraphs `a` to `b` cut where the selection starts and ends, those inside it changed by `f`. */
|
|
230
|
+
function mapRange(paras, a, b, f) {
|
|
231
|
+
return paras.map((p, i) => {
|
|
232
|
+
if (i < a.p || i > b.p)
|
|
233
|
+
return p;
|
|
234
|
+
const s = i === a.p ? a.o : 0;
|
|
235
|
+
const e = i === b.p ? b.o : lengthOf(p);
|
|
236
|
+
let at = 0;
|
|
237
|
+
const runs = [];
|
|
238
|
+
for (const r of p.runs) {
|
|
239
|
+
const from = at;
|
|
240
|
+
const to = at + r.text.length;
|
|
241
|
+
at = to;
|
|
242
|
+
const cuts = [
|
|
243
|
+
[from, Math.min(to, s), false],
|
|
244
|
+
[Math.max(from, s), Math.min(to, e), true],
|
|
245
|
+
[Math.max(from, e), to, false],
|
|
246
|
+
];
|
|
247
|
+
for (const [x, y, inside] of cuts) {
|
|
248
|
+
if (y <= x)
|
|
249
|
+
continue;
|
|
250
|
+
const piece = { ...r, text: r.text.slice(x - from, y - from) };
|
|
251
|
+
runs.push(inside ? f(piece) : piece);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return { ...p, runs };
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
/** The runs inside the selection (each part of a run once). */
|
|
258
|
+
const runsIn = (paras, a, b) => {
|
|
259
|
+
const got = [];
|
|
260
|
+
mapRange(paras, a, b, (r) => {
|
|
261
|
+
got.push(r);
|
|
262
|
+
return r;
|
|
263
|
+
});
|
|
264
|
+
return got;
|
|
265
|
+
};
|
|
266
|
+
/** `run` put in paragraph `at.p` at `at.o`, the runs there cut round it. */
|
|
267
|
+
function insertAt(paras, at, run) {
|
|
268
|
+
return paras.map((p, i) => {
|
|
269
|
+
if (i !== at.p)
|
|
270
|
+
return p;
|
|
271
|
+
let n = 0;
|
|
272
|
+
const runs = [];
|
|
273
|
+
let put = false;
|
|
274
|
+
for (const r of p.runs) {
|
|
275
|
+
const to = n + r.text.length;
|
|
276
|
+
if (!put && at.o <= to) {
|
|
277
|
+
const cut = at.o - n;
|
|
278
|
+
runs.push({ ...r, text: r.text.slice(0, cut) }, run, { ...r, text: r.text.slice(cut) });
|
|
279
|
+
put = true;
|
|
280
|
+
}
|
|
281
|
+
else
|
|
282
|
+
runs.push(r);
|
|
283
|
+
n = to;
|
|
284
|
+
}
|
|
285
|
+
if (!put)
|
|
286
|
+
runs.push(run);
|
|
287
|
+
return { ...p, runs };
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
/** The look of the words just before `at` (or just after, at a line's start): what words typed there would wear. */
|
|
291
|
+
function lookBefore(paras, at) {
|
|
292
|
+
const p = paras[at.p];
|
|
293
|
+
let n = 0;
|
|
294
|
+
let found;
|
|
295
|
+
for (const r of p?.runs ?? []) {
|
|
296
|
+
if (n < at.o)
|
|
297
|
+
found = r;
|
|
298
|
+
else if (!found)
|
|
299
|
+
found = r;
|
|
300
|
+
n += r.text.length;
|
|
301
|
+
}
|
|
302
|
+
const { text: _, ...look } = found ?? { text: '' };
|
|
303
|
+
return look;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Words with a look of their own, as a field holds them while it is typed into (2026-11-08, Slides): each word bold,
|
|
307
|
+
* italic, a link, in a size, font and colour of its own, each line in its own align and a list's item or not, drawn
|
|
308
|
+
* as it will be as it is typed. The consumer's bar acts on the selection through `handle`, and shows `onFormat`.
|
|
309
|
+
* Blueprint components/canvas.md, Canvas.RichEdit.
|
|
310
|
+
*/
|
|
311
|
+
export function CanvasRichEdit({ at, value, font, fonts = {}, colors = {}, names = {}, label, onChange, onGrow, onDone, onFormat, onKeyDown, handle, select = 'all' }) {
|
|
312
|
+
const { view } = useCanvas();
|
|
313
|
+
const field = useRef(null);
|
|
314
|
+
const done = useRef(onDone);
|
|
315
|
+
done.current = onDone;
|
|
316
|
+
const told = useRef(onFormat);
|
|
317
|
+
told.current = onFormat;
|
|
318
|
+
const maps = useRef({ fonts, colors });
|
|
319
|
+
maps.current = { fonts, colors };
|
|
320
|
+
const k = useRef(view.k);
|
|
321
|
+
k.current = view.k;
|
|
322
|
+
const base = useRef({ font, names });
|
|
323
|
+
base.current = { font, names };
|
|
324
|
+
// What the field last said, and the words it was last given: words given are put in only when they are news, never
|
|
325
|
+
// the consumer's echo of what the field just said, so the caret stays where it is.
|
|
326
|
+
const last = useRef('');
|
|
327
|
+
const given = useRef(null);
|
|
328
|
+
const echo = useRef(false);
|
|
329
|
+
const saved = useRef(null);
|
|
330
|
+
const format = useRef('');
|
|
331
|
+
// A look chosen with nothing selected: the words typed next wear it, until the caret moves elsewhere.
|
|
332
|
+
const pending = useRef(null);
|
|
333
|
+
const align = (font.align ?? 'start');
|
|
334
|
+
const render = (paras) => {
|
|
335
|
+
const f = field.current;
|
|
336
|
+
if (f)
|
|
337
|
+
f.innerHTML = htmlOf(paras, maps.current);
|
|
338
|
+
};
|
|
339
|
+
useLayoutEffect(() => {
|
|
340
|
+
const f = field.current;
|
|
341
|
+
if (!f)
|
|
342
|
+
return;
|
|
343
|
+
const now = JSON.stringify(normalizeParagraphs(value));
|
|
344
|
+
if (now === given.current)
|
|
345
|
+
return;
|
|
346
|
+
given.current = now;
|
|
347
|
+
if (echo.current) {
|
|
348
|
+
echo.current = false;
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
if (now === last.current)
|
|
352
|
+
return;
|
|
353
|
+
last.current = now;
|
|
354
|
+
render(JSON.parse(now));
|
|
355
|
+
});
|
|
356
|
+
const say = (now) => {
|
|
357
|
+
const said = JSON.stringify(now);
|
|
358
|
+
if (said === last.current)
|
|
359
|
+
return;
|
|
360
|
+
last.current = said;
|
|
361
|
+
echo.current = true;
|
|
362
|
+
requestAnimationFrame(() => {
|
|
363
|
+
echo.current = false;
|
|
364
|
+
});
|
|
365
|
+
onChange(now);
|
|
366
|
+
};
|
|
367
|
+
const emit = () => {
|
|
368
|
+
const f = field.current;
|
|
369
|
+
if (f)
|
|
370
|
+
say(readField(f, k.current, maps.current));
|
|
371
|
+
};
|
|
372
|
+
const inField = (n) => !!n && !!field.current?.contains(n);
|
|
373
|
+
const restore = () => {
|
|
374
|
+
const f = field.current;
|
|
375
|
+
if (!f)
|
|
376
|
+
return;
|
|
377
|
+
if (document.activeElement === f)
|
|
378
|
+
return;
|
|
379
|
+
// Back from a menu or a panel: the focus, and the selection it left (focus alone puts the caret at the start).
|
|
380
|
+
f.focus({ preventScroll: true });
|
|
381
|
+
const sel = window.getSelection();
|
|
382
|
+
if (saved.current && sel) {
|
|
383
|
+
sel.removeAllRanges();
|
|
384
|
+
sel.addRange(saved.current);
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
/** The words as they are, and where the selection starts and ends in them, read by marking both in the field. */
|
|
388
|
+
const marked = () => {
|
|
389
|
+
const f = field.current;
|
|
390
|
+
const sel = window.getSelection();
|
|
391
|
+
if (!f || !sel || !sel.rangeCount || !inField(sel.anchorNode))
|
|
392
|
+
return null;
|
|
393
|
+
const r = sel.getRangeAt(0);
|
|
394
|
+
const end = r.cloneRange();
|
|
395
|
+
end.collapse(false);
|
|
396
|
+
const start = r.cloneRange();
|
|
397
|
+
start.collapse(true);
|
|
398
|
+
const e = document.createTextNode(END);
|
|
399
|
+
const s = document.createTextNode(START);
|
|
400
|
+
end.insertNode(e);
|
|
401
|
+
start.insertNode(s);
|
|
402
|
+
const read = readField(f, k.current, maps.current);
|
|
403
|
+
s.remove();
|
|
404
|
+
e.remove();
|
|
405
|
+
f.normalize();
|
|
406
|
+
let a = { p: 0, o: 0 };
|
|
407
|
+
let b = { p: 0, o: 0 };
|
|
408
|
+
const paras = read.map((p, i) => {
|
|
409
|
+
const text = p.runs.map((x) => x.text).join('');
|
|
410
|
+
const si = text.indexOf(START);
|
|
411
|
+
const ei = text.indexOf(END);
|
|
412
|
+
if (si >= 0)
|
|
413
|
+
a = { p: i, o: si };
|
|
414
|
+
if (ei >= 0)
|
|
415
|
+
b = { p: i, o: ei - (si >= 0 && si < ei ? 1 : 0) };
|
|
416
|
+
return { ...p, runs: p.runs.map((x) => ({ ...x, text: x.text.replace(/[]/g, '') })) };
|
|
417
|
+
});
|
|
418
|
+
return { paras: normalizeParagraphs(paras), a, b };
|
|
419
|
+
};
|
|
420
|
+
/** The caret or selection put at these places in the field as it now is. */
|
|
421
|
+
const place = (a, b) => {
|
|
422
|
+
const f = field.current;
|
|
423
|
+
const sel = window.getSelection();
|
|
424
|
+
if (!f || !sel)
|
|
425
|
+
return;
|
|
426
|
+
const lines = [...f.querySelectorAll(':scope > div, :scope > ul > li, :scope > ol > li')];
|
|
427
|
+
const point = (pos) => {
|
|
428
|
+
const line = lines[Math.min(pos.p, lines.length - 1)];
|
|
429
|
+
if (!line)
|
|
430
|
+
return [f, 0];
|
|
431
|
+
const walker = document.createTreeWalker(line, NodeFilter.SHOW_TEXT);
|
|
432
|
+
let left = pos.o;
|
|
433
|
+
let lastText = null;
|
|
434
|
+
for (let t = walker.nextNode(); t; t = walker.nextNode()) {
|
|
435
|
+
if (left <= t.length)
|
|
436
|
+
return [t, left];
|
|
437
|
+
left -= t.length;
|
|
438
|
+
lastText = t;
|
|
439
|
+
}
|
|
440
|
+
return lastText ? [lastText, lastText.length] : [line, 0];
|
|
441
|
+
};
|
|
442
|
+
const r = document.createRange();
|
|
443
|
+
r.setStart(...point(a));
|
|
444
|
+
r.setEnd(...point(b));
|
|
445
|
+
sel.removeAllRanges();
|
|
446
|
+
sel.addRange(r);
|
|
447
|
+
saved.current = r.cloneRange();
|
|
448
|
+
};
|
|
449
|
+
/** The words changed as `change` says, drawn again, said, and the selection kept (or put where it says). */
|
|
450
|
+
const edit = (change) => {
|
|
451
|
+
restore();
|
|
452
|
+
const m = marked();
|
|
453
|
+
if (!m)
|
|
454
|
+
return;
|
|
455
|
+
const next = change(m);
|
|
456
|
+
if (!next)
|
|
457
|
+
return;
|
|
458
|
+
const paras = normalizeParagraphs(next.paras);
|
|
459
|
+
render(paras);
|
|
460
|
+
place(next.a ?? m.a, next.b ?? m.b);
|
|
461
|
+
say(paras);
|
|
462
|
+
moved();
|
|
463
|
+
};
|
|
464
|
+
/** A look chosen with nothing selected, for the words typed next where the caret is. */
|
|
465
|
+
const later = (m, look) => {
|
|
466
|
+
pending.current = { look: { ...(pending.current?.look ?? {}), ...look }, at: m.a };
|
|
467
|
+
format.current = '';
|
|
468
|
+
moved();
|
|
469
|
+
return null;
|
|
470
|
+
};
|
|
471
|
+
const ops = {
|
|
472
|
+
toggle: (mark) => edit((m) => {
|
|
473
|
+
if (collapsed(m)) {
|
|
474
|
+
const now = pending.current?.look[mark] ?? lookBefore(m.paras, m.a)[mark] ?? false;
|
|
475
|
+
return later(m, { [mark]: !now });
|
|
476
|
+
}
|
|
477
|
+
const runs = runsIn(m.paras, m.a, m.b).filter((r) => r.text.trim());
|
|
478
|
+
const on = !(runs.length && runs.every((r) => r[mark]));
|
|
479
|
+
return { paras: mapRange(m.paras, m.a, m.b, (r) => ({ ...r, [mark]: on })) };
|
|
480
|
+
}),
|
|
481
|
+
set: (look) => edit((m) => (collapsed(m) ? later(m, look) : { paras: mapRange(m.paras, m.a, m.b, (r) => ({ ...r, ...look })) })),
|
|
482
|
+
list: (kind) => edit((m) => {
|
|
483
|
+
const touched = touches(m);
|
|
484
|
+
const off = m.paras.filter((_, i) => touched(i)).every((p) => p.list === kind);
|
|
485
|
+
return { paras: m.paras.map((p, i) => (touched(i) ? { ...p, list: off ? null : kind, n: 1 } : p)) };
|
|
486
|
+
}),
|
|
487
|
+
align: (to) => edit((m) => {
|
|
488
|
+
const touched = touches(m);
|
|
489
|
+
return { paras: m.paras.map((p, i) => (touched(i) ? { ...p, align: to } : p)) };
|
|
490
|
+
}),
|
|
491
|
+
link: (href) => edit((m) => {
|
|
492
|
+
const off = ({ href: _, ...r }) => r;
|
|
493
|
+
if (!href) {
|
|
494
|
+
// Taken off the whole link the caret is in, or off whatever is selected.
|
|
495
|
+
const p = m.paras[m.a.p];
|
|
496
|
+
let n = 0;
|
|
497
|
+
let hit;
|
|
498
|
+
for (const r of p.runs) {
|
|
499
|
+
if (r.href && n <= m.a.o && m.a.o <= n + r.text.length)
|
|
500
|
+
hit = r.href;
|
|
501
|
+
n += r.text.length;
|
|
502
|
+
}
|
|
503
|
+
if (!hit || !collapsed(m))
|
|
504
|
+
return { paras: mapRange(m.paras, m.a, m.b, off) };
|
|
505
|
+
let from = m.a.o;
|
|
506
|
+
let to = m.a.o;
|
|
507
|
+
n = 0;
|
|
508
|
+
for (const r of p.runs) {
|
|
509
|
+
if (r.href === hit && n <= to && n + r.text.length >= from) {
|
|
510
|
+
from = Math.min(from, n);
|
|
511
|
+
to = Math.max(to, n + r.text.length);
|
|
512
|
+
}
|
|
513
|
+
n += r.text.length;
|
|
514
|
+
}
|
|
515
|
+
return { paras: mapRange(m.paras, { p: m.a.p, o: from }, { p: m.a.p, o: to }, off) };
|
|
516
|
+
}
|
|
517
|
+
if (!collapsed(m))
|
|
518
|
+
return { paras: mapRange(m.paras, m.a, m.b, (r) => ({ ...r, href })) };
|
|
519
|
+
// Nothing selected: the address itself, as a link, at the caret.
|
|
520
|
+
const after = { p: m.a.p, o: m.a.o + href.length };
|
|
521
|
+
return { paras: insertAt(m.paras, m.a, { ...lookBefore(m.paras, m.a), text: href, href }), a: after, b: after };
|
|
522
|
+
}),
|
|
523
|
+
focus: restore,
|
|
524
|
+
};
|
|
525
|
+
useImperativeHandle(handle, () => ops);
|
|
526
|
+
/** How the words at the caret look, read from the field. */
|
|
527
|
+
const formatAt = () => {
|
|
528
|
+
const s = window.getSelection();
|
|
529
|
+
const f = field.current;
|
|
530
|
+
if (!f || !s || !s.rangeCount || !inField(s.anchorNode))
|
|
531
|
+
return null;
|
|
532
|
+
// A caret at a line's start, after an element: the words after it.
|
|
533
|
+
let node = s.anchorNode;
|
|
534
|
+
if (node instanceof HTMLElement && node.childNodes[s.anchorOffset])
|
|
535
|
+
node = node.childNodes[Math.max(0, s.anchorOffset - 1)] ?? node;
|
|
536
|
+
let el = node instanceof HTMLElement ? node : node?.parentElement ?? null;
|
|
537
|
+
const look = {};
|
|
538
|
+
let lineAlign;
|
|
539
|
+
let list = null;
|
|
540
|
+
for (; el && el !== f; el = el.parentElement) {
|
|
541
|
+
const own = lookOfElement(el, k.current, maps.current);
|
|
542
|
+
for (const key of LOOKS)
|
|
543
|
+
if (look[key] === undefined && own[key] !== undefined)
|
|
544
|
+
look[key] = own[key];
|
|
545
|
+
if (!lineAlign && BLOCKS.has(el.tagName))
|
|
546
|
+
lineAlign = alignOf(el);
|
|
547
|
+
if (!list && el.tagName === 'LI')
|
|
548
|
+
list = el.parentElement?.tagName === 'OL' ? 'number' : 'bullet';
|
|
549
|
+
}
|
|
550
|
+
const b = base.current;
|
|
551
|
+
const p = pending.current?.look ?? {};
|
|
552
|
+
return {
|
|
553
|
+
bold: p.bold ?? look.bold ?? false,
|
|
554
|
+
italic: p.italic ?? look.italic ?? false,
|
|
555
|
+
size: p.size ?? look.size ?? b.font.size,
|
|
556
|
+
font: p.font ?? look.font ?? b.names.font ?? null,
|
|
557
|
+
color: p.color ?? look.color ?? b.names.color ?? null,
|
|
558
|
+
link: look.href ?? null,
|
|
559
|
+
list,
|
|
560
|
+
align: lineAlign ?? (b.font.align ?? 'start'),
|
|
561
|
+
};
|
|
562
|
+
};
|
|
563
|
+
// Where the selection is, kept for the bar's menus and panels (which take the focus), and how the words there look.
|
|
564
|
+
const moved = () => {
|
|
565
|
+
const s = window.getSelection();
|
|
566
|
+
if (!s || !s.rangeCount || !inField(s.anchorNode))
|
|
567
|
+
return;
|
|
568
|
+
saved.current = s.getRangeAt(0).cloneRange();
|
|
569
|
+
const now = formatAt();
|
|
570
|
+
if (!now)
|
|
571
|
+
return;
|
|
572
|
+
const key = JSON.stringify(now);
|
|
573
|
+
if (key === format.current)
|
|
574
|
+
return;
|
|
575
|
+
format.current = key;
|
|
576
|
+
told.current?.(now);
|
|
577
|
+
};
|
|
578
|
+
useEffect(() => {
|
|
579
|
+
const f = field.current;
|
|
580
|
+
if (!f)
|
|
581
|
+
return;
|
|
582
|
+
f.focus({ preventScroll: true });
|
|
583
|
+
const r = document.createRange();
|
|
584
|
+
r.selectNodeContents(f);
|
|
585
|
+
if (select === 'end')
|
|
586
|
+
r.collapse(false);
|
|
587
|
+
const sel = window.getSelection();
|
|
588
|
+
sel?.removeAllRanges();
|
|
589
|
+
sel?.addRange(r);
|
|
590
|
+
const changed = () => {
|
|
591
|
+
const s = window.getSelection();
|
|
592
|
+
if (!s || !s.rangeCount || !inField(s.anchorNode))
|
|
593
|
+
return;
|
|
594
|
+
// The caret moved elsewhere: a look chosen with nothing selected was for where it was.
|
|
595
|
+
if (pending.current && !s.isCollapsed)
|
|
596
|
+
pending.current = null;
|
|
597
|
+
moved();
|
|
598
|
+
};
|
|
599
|
+
// A press anywhere but the field, a floating bar, a pin or an Inspector's body (2026-11-08) is done typing; one in the field moves the caret,
|
|
600
|
+
// and a look chosen for where it was is dropped.
|
|
601
|
+
const pressed = (e) => {
|
|
602
|
+
const t = e.target;
|
|
603
|
+
if (inField(t)) {
|
|
604
|
+
pending.current = null;
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
607
|
+
if (t?.closest?.('.newtone-floating-bar, .newtone-canvas-pin, .newtone-inspector, [data-newtone-edit-keep]'))
|
|
608
|
+
return;
|
|
609
|
+
done.current();
|
|
610
|
+
};
|
|
611
|
+
document.addEventListener('selectionchange', changed);
|
|
612
|
+
document.addEventListener('pointerdown', pressed, true);
|
|
613
|
+
moved();
|
|
614
|
+
return () => {
|
|
615
|
+
document.removeEventListener('selectionchange', changed);
|
|
616
|
+
document.removeEventListener('pointerdown', pressed, true);
|
|
617
|
+
};
|
|
618
|
+
// Opened once; what is selected after that is the person's.
|
|
619
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
620
|
+
}, []);
|
|
621
|
+
// As tall as its words: the consumer told the height in its own units.
|
|
622
|
+
const tall = useRef(0);
|
|
623
|
+
useLayoutEffect(() => {
|
|
624
|
+
const f = field.current;
|
|
625
|
+
if (!f)
|
|
626
|
+
return;
|
|
627
|
+
const units = f.scrollHeight / view.k;
|
|
628
|
+
if (Math.abs(units - tall.current) > 0.5) {
|
|
629
|
+
tall.current = units;
|
|
630
|
+
onGrow?.(units);
|
|
631
|
+
}
|
|
632
|
+
});
|
|
633
|
+
const style = {
|
|
634
|
+
insetInlineStart: view.x + at.x * view.k,
|
|
635
|
+
insetBlockStart: view.y + at.y * view.k,
|
|
636
|
+
inlineSize: Math.max(1, at.width * view.k),
|
|
637
|
+
minBlockSize: at.height * view.k,
|
|
638
|
+
fontFamily: font.family,
|
|
639
|
+
fontSize: font.size * view.k,
|
|
640
|
+
fontWeight: font.weight,
|
|
641
|
+
fontStyle: font.style,
|
|
642
|
+
lineHeight: font.lineHeight ?? 1.2,
|
|
643
|
+
textAlign: align,
|
|
644
|
+
color: font.color,
|
|
645
|
+
'--newtone-edit-k': view.k,
|
|
646
|
+
'--newtone-edit-link': font.link ?? 'currentColor',
|
|
647
|
+
'--newtone-edit-bullet': `${CANVAS_EDIT_INDENT.bullet}em`,
|
|
648
|
+
'--newtone-edit-number': `${CANVAS_EDIT_INDENT.number}em`,
|
|
649
|
+
};
|
|
650
|
+
return (_jsx("div", { ref: field, className: "newtone-canvas-edit newtone-canvas-rich", role: "textbox", "aria-multiline": "true", "aria-label": label, contentEditable: true, suppressContentEditableWarning: true, spellCheck: true, "data-align": align, style: style, onInput: emit, onBeforeInput: (e) => {
|
|
651
|
+
// The first words typed after a look was chosen with nothing selected wear it; the rest follow them.
|
|
652
|
+
const p = pending.current;
|
|
653
|
+
const native = e.nativeEvent;
|
|
654
|
+
const data = native.data;
|
|
655
|
+
if (!p || native.inputType !== 'insertText' || !data)
|
|
656
|
+
return;
|
|
657
|
+
e.preventDefault();
|
|
658
|
+
pending.current = null;
|
|
659
|
+
edit((m) => {
|
|
660
|
+
const after = { p: m.a.p, o: m.a.o + data.length };
|
|
661
|
+
const cut = collapsed(m) ? m.paras : mapRange(m.paras, m.a, m.b, (r) => ({ ...r, text: '' }));
|
|
662
|
+
return { paras: insertAt(cut, m.a, { ...lookBefore(m.paras, m.a), ...p.look, text: data }), a: after, b: after };
|
|
663
|
+
});
|
|
664
|
+
}, onKeyDown: (e) => {
|
|
665
|
+
// The arrows, Delete and Space are the field's while it is open, never the plane's.
|
|
666
|
+
e.stopPropagation();
|
|
667
|
+
onKeyDown?.(e);
|
|
668
|
+
if (e.defaultPrevented)
|
|
669
|
+
return;
|
|
670
|
+
const meta = e.metaKey || e.ctrlKey;
|
|
671
|
+
const key = e.key.toLowerCase();
|
|
672
|
+
if (e.key === 'Escape') {
|
|
673
|
+
e.preventDefault();
|
|
674
|
+
done.current();
|
|
675
|
+
}
|
|
676
|
+
else if (meta && !e.shiftKey && (key === 'b' || key === 'i')) {
|
|
677
|
+
e.preventDefault();
|
|
678
|
+
ops.toggle(key === 'b' ? 'bold' : 'italic');
|
|
679
|
+
}
|
|
680
|
+
else if (meta && !e.shiftKey && key === 'u') {
|
|
681
|
+
// Underline is not a look the words keep.
|
|
682
|
+
e.preventDefault();
|
|
683
|
+
}
|
|
684
|
+
else if (meta && e.shiftKey && (e.code === 'Digit8' || e.code === 'Digit7')) {
|
|
685
|
+
e.preventDefault();
|
|
686
|
+
ops.list(e.code === 'Digit8' ? 'bullet' : 'number');
|
|
687
|
+
}
|
|
688
|
+
}, onPaste: (e) => {
|
|
689
|
+
// Words pasted come as words, in the look where they land.
|
|
690
|
+
e.preventDefault();
|
|
691
|
+
document.execCommand('insertText', false, e.clipboardData.getData('text/plain'));
|
|
692
|
+
}, onPointerDown: (e) => e.stopPropagation() }));
|
|
693
|
+
}
|
|
694
|
+
//# sourceMappingURL=rich.js.map
|