kritzel-stencil 0.0.172 → 0.1.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/cjs/app-globals-V2Kpy_OQ.js +0 -3
- package/dist/cjs/{default-line-tool.config-JuTDR6PF.js → default-line-tool.config-7eJND6Jb.js} +1516 -206
- package/dist/cjs/index-BeKMS-Zt.js +3280 -0
- package/dist/cjs/index.cjs.js +10 -7
- package/dist/cjs/kritzel-brush-style.cjs.entry.js +3 -4
- package/dist/cjs/kritzel-color_22.cjs.entry.js +103 -66
- package/dist/cjs/loader.cjs.js +2 -3
- package/dist/cjs/stencil.cjs.js +3 -4
- package/dist/collection/classes/core/core.class.js +0 -1
- package/dist/collection/classes/core/reviver.class.js +0 -1
- package/dist/collection/classes/core/store.class.js +0 -1
- package/dist/collection/classes/core/viewport.class.js +0 -1
- package/dist/collection/classes/core/workspace.class.js +0 -1
- package/dist/collection/classes/handlers/base.handler.js +0 -1
- package/dist/collection/classes/handlers/context-menu.handler.js +0 -1
- package/dist/collection/classes/handlers/hover.handler.js +0 -1
- package/dist/collection/classes/handlers/key.handler.js +0 -1
- package/dist/collection/classes/handlers/line-handle.handler.js +0 -1
- package/dist/collection/classes/handlers/move.handler.js +0 -1
- package/dist/collection/classes/handlers/resize.handler.js +0 -1
- package/dist/collection/classes/handlers/rotation.handler.js +0 -1
- package/dist/collection/classes/handlers/selection.handler.js +0 -1
- package/dist/collection/classes/managers/anchor.manager.js +0 -1
- package/dist/collection/classes/managers/cursor.manager.js +0 -1
- package/dist/collection/classes/objects/base-object.class.js +0 -1
- package/dist/collection/classes/objects/custom-element.class.js +0 -1
- package/dist/collection/classes/objects/group.class.js +0 -1
- package/dist/collection/classes/objects/image.class.js +0 -1
- package/dist/collection/classes/objects/line.class.js +0 -1
- package/dist/collection/classes/objects/path.class.js +0 -1
- package/dist/collection/classes/objects/selection-box.class.js +0 -1
- package/dist/collection/classes/objects/selection-group.class.js +0 -1
- package/dist/collection/classes/objects/shape.class.js +0 -1
- package/dist/collection/classes/objects/text.class.js +0 -1
- package/dist/collection/classes/providers/broadcast-sync-provider.class.js +0 -1
- package/dist/collection/classes/providers/hocuspocus-sync-provider.class.js +0 -1
- package/dist/collection/classes/providers/indexeddb-sync-provider.class.js +0 -1
- package/dist/collection/classes/providers/websocket-sync-provider.class.js +0 -1
- package/dist/collection/classes/registries/icon-registry.class.js +0 -1
- package/dist/collection/classes/registries/tool.registry.js +0 -1
- package/dist/collection/classes/structures/app-state-map.structure.js +0 -1
- package/dist/collection/classes/structures/object-map.structure.js +0 -1
- package/dist/collection/classes/structures/quadtree.structure.js +0 -1
- package/dist/collection/classes/tools/base-tool.class.js +0 -1
- package/dist/collection/classes/tools/brush-tool.class.js +0 -1
- package/dist/collection/classes/tools/eraser-tool.class.js +0 -1
- package/dist/collection/classes/tools/image-tool.class.js +0 -1
- package/dist/collection/classes/tools/line-tool.class.js +0 -1
- package/dist/collection/classes/tools/selection-tool.class.js +0 -1
- package/dist/collection/classes/tools/shape-tool.class.js +0 -1
- package/dist/collection/classes/tools/text-tool.class.js +0 -1
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/core/kritzel-cursor-trail/kritzel-cursor-trail.js +0 -1
- package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +1 -2
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +3 -4
- package/dist/collection/components/shared/kritzel-brush-style/kritzel-brush-style.js +0 -1
- package/dist/collection/components/shared/kritzel-color/kritzel-color.js +0 -1
- package/dist/collection/components/shared/kritzel-color-palette/kritzel-color-palette.js +8 -3
- package/dist/collection/components/shared/kritzel-dropdown/kritzel-dropdown.css +8 -20
- package/dist/collection/components/shared/kritzel-dropdown/kritzel-dropdown.js +1 -2
- package/dist/collection/components/shared/kritzel-font/kritzel-font.js +0 -1
- package/dist/collection/components/shared/kritzel-font-family/kritzel-font-family.js +0 -1
- package/dist/collection/components/shared/kritzel-font-size/kritzel-font-size.js +8 -3
- package/dist/collection/components/shared/kritzel-icon/kritzel-icon.js +0 -1
- package/dist/collection/components/shared/kritzel-menu/kritzel-menu.js +0 -1
- package/dist/collection/components/shared/kritzel-menu-item/kritzel-menu-item.js +0 -1
- package/dist/collection/components/shared/kritzel-portal/kritzel-portal.js +0 -1
- package/dist/collection/components/shared/kritzel-split-button/kritzel-split-button.js +0 -1
- package/dist/collection/components/shared/kritzel-stroke-size/kritzel-stroke-size.js +0 -1
- package/dist/collection/components/shared/kritzel-tooltip/kritzel-tooltip.js +0 -1
- package/dist/collection/components/ui/kritzel-context-menu/kritzel-context-menu.js +0 -1
- package/dist/collection/components/ui/kritzel-control-brush-config/kritzel-control-brush-config.js +0 -1
- package/dist/collection/components/ui/kritzel-control-text-config/kritzel-control-text-config.js +1 -2
- package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js +0 -1
- package/dist/collection/components/ui/kritzel-utility-panel/kritzel-utility-panel.js +0 -1
- package/dist/collection/components/ui/kritzel-workspace-manager/kritzel-workspace-manager.js +0 -1
- package/dist/collection/configs/default-brush-tool.config.js +0 -1
- package/dist/collection/configs/default-engine-config.js +0 -1
- package/dist/collection/configs/default-line-tool.config.js +0 -1
- package/dist/collection/configs/default-shape-tool.config.js +0 -1
- package/dist/collection/configs/default-sync.config.js +0 -1
- package/dist/collection/configs/default-text-tool.config.js +0 -1
- package/dist/collection/constants/core.constants.js +0 -1
- package/dist/collection/constants/engine.constants.js +0 -1
- package/dist/collection/enums/event-button.enum.js +0 -1
- package/dist/collection/enums/handle-type.enum.js +0 -1
- package/dist/collection/enums/shape-type.enum.js +0 -1
- package/dist/collection/helpers/class.helper.js +0 -1
- package/dist/collection/helpers/cursor.helper.js +0 -1
- package/dist/collection/helpers/devices.helper.js +0 -1
- package/dist/collection/helpers/event.helper.js +0 -1
- package/dist/collection/helpers/geometry.helper.js +0 -1
- package/dist/collection/helpers/html.helper.js +0 -1
- package/dist/collection/helpers/keyboard.helper.js +0 -1
- package/dist/collection/helpers/math.helper.js +0 -1
- package/dist/collection/helpers/object.helper.js +0 -1
- package/dist/collection/index.js +0 -1
- package/dist/collection/interfaces/anchor.interface.js +0 -1
- package/dist/collection/interfaces/arrow-head.interface.js +0 -1
- package/dist/collection/interfaces/bounding-box.interface.js +0 -1
- package/dist/collection/interfaces/clonable.interface.js +0 -1
- package/dist/collection/interfaces/context-menu-item.interface.js +0 -1
- package/dist/collection/interfaces/debug-info.interface.js +0 -1
- package/dist/collection/interfaces/engine-state.interface.js +0 -1
- package/dist/collection/interfaces/line-options.interface.js +0 -1
- package/dist/collection/interfaces/menu-item.interface.js +0 -1
- package/dist/collection/interfaces/object.interface.js +0 -1
- package/dist/collection/interfaces/path-options.interface.js +0 -1
- package/dist/collection/interfaces/point.interface.js +0 -1
- package/dist/collection/interfaces/polygon.interface.js +0 -1
- package/dist/collection/interfaces/selection-state.interface.js +0 -1
- package/dist/collection/interfaces/serializable.interface.js +0 -1
- package/dist/collection/interfaces/shortcut.interface.js +0 -1
- package/dist/collection/interfaces/sync-config.interface.js +0 -1
- package/dist/collection/interfaces/sync-provider.interface.js +0 -1
- package/dist/collection/interfaces/tool.interface.js +0 -1
- package/dist/collection/interfaces/toolbar-control.interface.js +0 -1
- package/dist/collection/interfaces/undo-state.interface.js +0 -1
- package/dist/collection/types/deep-readonly.type.js +0 -1
- package/dist/collection/types/state.types.js +0 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -1477
- package/dist/components/kritzel-brush-style.js +1 -67
- package/dist/components/kritzel-color-palette.js +1 -9
- package/dist/components/kritzel-color.js +1 -9
- package/dist/components/kritzel-context-menu.js +1 -9
- package/dist/components/kritzel-control-brush-config.js +1 -9
- package/dist/components/kritzel-control-text-config.js +1 -9
- package/dist/components/kritzel-controls.js +1 -9
- package/dist/components/kritzel-cursor-trail.js +1 -9
- package/dist/components/kritzel-dropdown.js +1 -9
- package/dist/components/kritzel-editor.js +1 -605
- package/dist/components/kritzel-engine.js +1 -9
- package/dist/components/kritzel-font-family.js +1 -9
- package/dist/components/kritzel-font-size.js +1 -9
- package/dist/components/kritzel-font.js +1 -9
- package/dist/components/kritzel-icon.js +1 -9
- package/dist/components/kritzel-menu-item.js +1 -9
- package/dist/components/kritzel-menu.js +1 -9
- package/dist/components/kritzel-portal.js +1 -9
- package/dist/components/kritzel-split-button.js +1 -9
- package/dist/components/kritzel-stroke-size.js +1 -9
- package/dist/components/kritzel-tooltip.js +1 -9
- package/dist/components/kritzel-utility-panel.js +1 -9
- package/dist/components/kritzel-workspace-manager.js +1 -9
- package/dist/components/p-1z-ds26_.js +1 -0
- package/dist/components/p-4FEa4ADy.js +1 -0
- package/dist/components/p-B0kd2rUI.js +1 -16
- package/dist/components/p-B7Fdo5QJ.js +1 -0
- package/dist/components/p-BXaWhpO2.js +1 -0
- package/dist/components/p-Bj_Og27M.js +1 -0
- package/dist/components/p-BtuXeItZ.js +1 -0
- package/dist/components/p-C-d2IH4v.js +1 -0
- package/dist/components/p-C3UriJh7.js +1 -0
- package/dist/components/p-C4krHoUl.js +1 -0
- package/dist/components/p-C6qB08BS.js +1 -68
- package/dist/components/p-CF5L2Gdl.js +1 -0
- package/dist/components/p-CXzfYQ_u.js +1 -0
- package/dist/components/p-CeKT_dTd.js +1 -0
- package/dist/components/p-Cp15toXH.js +1 -0
- package/dist/components/p-Cy77SpWt.js +1 -0
- package/dist/components/p-D1tfzpy8.js +1 -0
- package/dist/components/p-D3LRBk2t.js +9 -0
- package/dist/components/p-D5ZsALCP.js +1 -0
- package/dist/components/p-D8W6LE-c.js +1 -11
- package/dist/components/p-DB5s1NY4.js +1 -0
- package/dist/components/p-DTezr6w9.js +1 -0
- package/dist/components/p-Du1vxHy8.js +1 -0
- package/dist/components/p-IAqZFssU.js +1 -0
- package/dist/components/p-g0N9j_uT.js +1 -0
- package/dist/components/p-l10It7Nm.js +1 -30
- package/dist/components/p-n789Y3S-.js +1 -45
- package/dist/esm/app-globals-DQuL1Twl.js +0 -3
- package/dist/esm/{default-line-tool.config-CuBm2vpW.js → default-line-tool.config-CD5sTKH-.js} +1515 -205
- package/dist/esm/index-BqhmuUH2.js +3253 -0
- package/dist/esm/index.js +11 -8
- package/dist/esm/kritzel-brush-style.entry.js +3 -4
- package/dist/esm/kritzel-color_22.entry.js +103 -66
- package/dist/esm/loader.js +3 -4
- package/dist/esm/stencil.js +4 -5
- package/dist/stencil/index.esm.js +1 -2
- package/dist/stencil/p-09295079.entry.js +1 -0
- package/dist/stencil/p-381c0e9c.entry.js +9 -0
- package/dist/stencil/p-BqhmuUH2.js +2 -0
- package/dist/stencil/p-CD5sTKH-.js +1 -0
- package/dist/stencil/p-DQuL1Twl.js +1 -2
- package/dist/stencil/stencil.esm.js +1 -2
- package/dist/types/components/shared/kritzel-color-palette/kritzel-color-palette.d.ts +1 -0
- package/dist/types/components/shared/kritzel-font-size/kritzel-font-size.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +57 -3
- package/package.json +6 -1
- package/dist/cjs/app-globals-V2Kpy_OQ.js.map +0 -1
- package/dist/cjs/default-line-tool.config-JuTDR6PF.js.map +0 -1
- package/dist/cjs/index-Cj__YTlG.js +0 -1650
- package/dist/cjs/index-Cj__YTlG.js.map +0 -1
- package/dist/cjs/index.cjs.js.map +0 -1
- package/dist/cjs/kritzel-brush-style.entry.cjs.js.map +0 -1
- package/dist/cjs/loader.cjs.js.map +0 -1
- package/dist/cjs/stencil.cjs.js.map +0 -1
- package/dist/collection/classes/core/core.class.js.map +0 -1
- package/dist/collection/classes/core/reviver.class.js.map +0 -1
- package/dist/collection/classes/core/store.class.js.map +0 -1
- package/dist/collection/classes/core/viewport.class.js.map +0 -1
- package/dist/collection/classes/core/workspace.class.js.map +0 -1
- package/dist/collection/classes/handlers/base.handler.js.map +0 -1
- package/dist/collection/classes/handlers/context-menu.handler.js.map +0 -1
- package/dist/collection/classes/handlers/hover.handler.js.map +0 -1
- package/dist/collection/classes/handlers/key.handler.js.map +0 -1
- package/dist/collection/classes/handlers/line-handle.handler.js.map +0 -1
- package/dist/collection/classes/handlers/move.handler.js.map +0 -1
- package/dist/collection/classes/handlers/resize.handler.js.map +0 -1
- package/dist/collection/classes/handlers/rotation.handler.js.map +0 -1
- package/dist/collection/classes/handlers/selection.handler.js.map +0 -1
- package/dist/collection/classes/managers/anchor.manager.js.map +0 -1
- package/dist/collection/classes/managers/cursor.manager.js.map +0 -1
- package/dist/collection/classes/objects/base-object.class.js.map +0 -1
- package/dist/collection/classes/objects/custom-element.class.js.map +0 -1
- package/dist/collection/classes/objects/group.class.js.map +0 -1
- package/dist/collection/classes/objects/image.class.js.map +0 -1
- package/dist/collection/classes/objects/line.class.js.map +0 -1
- package/dist/collection/classes/objects/path.class.js.map +0 -1
- package/dist/collection/classes/objects/selection-box.class.js.map +0 -1
- package/dist/collection/classes/objects/selection-group.class.js.map +0 -1
- package/dist/collection/classes/objects/shape.class.js.map +0 -1
- package/dist/collection/classes/objects/text.class.js.map +0 -1
- package/dist/collection/classes/providers/broadcast-sync-provider.class.js.map +0 -1
- package/dist/collection/classes/providers/hocuspocus-sync-provider.class.js.map +0 -1
- package/dist/collection/classes/providers/indexeddb-sync-provider.class.js.map +0 -1
- package/dist/collection/classes/providers/websocket-sync-provider.class.js.map +0 -1
- package/dist/collection/classes/registries/icon-registry.class.js.map +0 -1
- package/dist/collection/classes/registries/tool.registry.js.map +0 -1
- package/dist/collection/classes/structures/app-state-map.structure.js.map +0 -1
- package/dist/collection/classes/structures/object-map.structure.js.map +0 -1
- package/dist/collection/classes/structures/quadtree.structure.js.map +0 -1
- package/dist/collection/classes/tools/base-tool.class.js.map +0 -1
- package/dist/collection/classes/tools/brush-tool.class.js.map +0 -1
- package/dist/collection/classes/tools/eraser-tool.class.js.map +0 -1
- package/dist/collection/classes/tools/image-tool.class.js.map +0 -1
- package/dist/collection/classes/tools/line-tool.class.js.map +0 -1
- package/dist/collection/classes/tools/selection-tool.class.js.map +0 -1
- package/dist/collection/classes/tools/shape-tool.class.js.map +0 -1
- package/dist/collection/classes/tools/text-tool.class.js.map +0 -1
- package/dist/collection/components/core/kritzel-cursor-trail/kritzel-cursor-trail.js.map +0 -1
- package/dist/collection/components/core/kritzel-editor/kritzel-editor.js.map +0 -1
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js.map +0 -1
- package/dist/collection/components/shared/kritzel-brush-style/kritzel-brush-style.js.map +0 -1
- package/dist/collection/components/shared/kritzel-color/kritzel-color.js.map +0 -1
- package/dist/collection/components/shared/kritzel-color-palette/kritzel-color-palette.js.map +0 -1
- package/dist/collection/components/shared/kritzel-dropdown/kritzel-dropdown.js.map +0 -1
- package/dist/collection/components/shared/kritzel-font/kritzel-font.js.map +0 -1
- package/dist/collection/components/shared/kritzel-font-family/kritzel-font-family.js.map +0 -1
- package/dist/collection/components/shared/kritzel-font-size/kritzel-font-size.js.map +0 -1
- package/dist/collection/components/shared/kritzel-icon/kritzel-icon.js.map +0 -1
- package/dist/collection/components/shared/kritzel-menu/kritzel-menu.js.map +0 -1
- package/dist/collection/components/shared/kritzel-menu-item/kritzel-menu-item.js.map +0 -1
- package/dist/collection/components/shared/kritzel-portal/kritzel-portal.js.map +0 -1
- package/dist/collection/components/shared/kritzel-split-button/kritzel-split-button.js.map +0 -1
- package/dist/collection/components/shared/kritzel-stroke-size/kritzel-stroke-size.js.map +0 -1
- package/dist/collection/components/shared/kritzel-tooltip/kritzel-tooltip.js.map +0 -1
- package/dist/collection/components/ui/kritzel-context-menu/kritzel-context-menu.js.map +0 -1
- package/dist/collection/components/ui/kritzel-control-brush-config/kritzel-control-brush-config.js.map +0 -1
- package/dist/collection/components/ui/kritzel-control-text-config/kritzel-control-text-config.js.map +0 -1
- package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js.map +0 -1
- package/dist/collection/components/ui/kritzel-utility-panel/kritzel-utility-panel.js.map +0 -1
- package/dist/collection/components/ui/kritzel-workspace-manager/kritzel-workspace-manager.js.map +0 -1
- package/dist/collection/configs/default-brush-tool.config.js.map +0 -1
- package/dist/collection/configs/default-engine-config.js.map +0 -1
- package/dist/collection/configs/default-line-tool.config.js.map +0 -1
- package/dist/collection/configs/default-shape-tool.config.js.map +0 -1
- package/dist/collection/configs/default-sync.config.js.map +0 -1
- package/dist/collection/configs/default-text-tool.config.js.map +0 -1
- package/dist/collection/constants/core.constants.js.map +0 -1
- package/dist/collection/constants/engine.constants.js.map +0 -1
- package/dist/collection/enums/event-button.enum.js.map +0 -1
- package/dist/collection/enums/handle-type.enum.js.map +0 -1
- package/dist/collection/enums/shape-type.enum.js.map +0 -1
- package/dist/collection/helpers/class.helper.js.map +0 -1
- package/dist/collection/helpers/cursor.helper.js.map +0 -1
- package/dist/collection/helpers/devices.helper.js.map +0 -1
- package/dist/collection/helpers/event.helper.js.map +0 -1
- package/dist/collection/helpers/geometry.helper.js.map +0 -1
- package/dist/collection/helpers/html.helper.js.map +0 -1
- package/dist/collection/helpers/keyboard.helper.js.map +0 -1
- package/dist/collection/helpers/math.helper.js.map +0 -1
- package/dist/collection/helpers/object.helper.js.map +0 -1
- package/dist/collection/index.js.map +0 -1
- package/dist/collection/interfaces/anchor.interface.js.map +0 -1
- package/dist/collection/interfaces/arrow-head.interface.js.map +0 -1
- package/dist/collection/interfaces/bounding-box.interface.js.map +0 -1
- package/dist/collection/interfaces/clonable.interface.js.map +0 -1
- package/dist/collection/interfaces/context-menu-item.interface.js.map +0 -1
- package/dist/collection/interfaces/debug-info.interface.js.map +0 -1
- package/dist/collection/interfaces/engine-state.interface.js.map +0 -1
- package/dist/collection/interfaces/line-options.interface.js.map +0 -1
- package/dist/collection/interfaces/menu-item.interface.js.map +0 -1
- package/dist/collection/interfaces/object.interface.js.map +0 -1
- package/dist/collection/interfaces/path-options.interface.js.map +0 -1
- package/dist/collection/interfaces/point.interface.js.map +0 -1
- package/dist/collection/interfaces/polygon.interface.js.map +0 -1
- package/dist/collection/interfaces/selection-state.interface.js.map +0 -1
- package/dist/collection/interfaces/serializable.interface.js.map +0 -1
- package/dist/collection/interfaces/shortcut.interface.js.map +0 -1
- package/dist/collection/interfaces/sync-config.interface.js.map +0 -1
- package/dist/collection/interfaces/sync-provider.interface.js.map +0 -1
- package/dist/collection/interfaces/tool.interface.js.map +0 -1
- package/dist/collection/interfaces/toolbar-control.interface.js.map +0 -1
- package/dist/collection/interfaces/undo-state.interface.js.map +0 -1
- package/dist/collection/types/deep-readonly.type.js.map +0 -1
- package/dist/collection/types/state.types.js.map +0 -1
- package/dist/components/index.js.map +0 -1
- package/dist/components/kritzel-brush-style.js.map +0 -1
- package/dist/components/kritzel-color-palette.js.map +0 -1
- package/dist/components/kritzel-color.js.map +0 -1
- package/dist/components/kritzel-context-menu.js.map +0 -1
- package/dist/components/kritzel-control-brush-config.js.map +0 -1
- package/dist/components/kritzel-control-text-config.js.map +0 -1
- package/dist/components/kritzel-controls.js.map +0 -1
- package/dist/components/kritzel-cursor-trail.js.map +0 -1
- package/dist/components/kritzel-dropdown.js.map +0 -1
- package/dist/components/kritzel-editor.js.map +0 -1
- package/dist/components/kritzel-engine.js.map +0 -1
- package/dist/components/kritzel-font-family.js.map +0 -1
- package/dist/components/kritzel-font-size.js.map +0 -1
- package/dist/components/kritzel-font.js.map +0 -1
- package/dist/components/kritzel-icon.js.map +0 -1
- package/dist/components/kritzel-menu-item.js.map +0 -1
- package/dist/components/kritzel-menu.js.map +0 -1
- package/dist/components/kritzel-portal.js.map +0 -1
- package/dist/components/kritzel-split-button.js.map +0 -1
- package/dist/components/kritzel-stroke-size.js.map +0 -1
- package/dist/components/kritzel-tooltip.js.map +0 -1
- package/dist/components/kritzel-utility-panel.js.map +0 -1
- package/dist/components/kritzel-workspace-manager.js.map +0 -1
- package/dist/components/p-B0kd2rUI.js.map +0 -1
- package/dist/components/p-B80ry-r4.js +0 -103
- package/dist/components/p-B80ry-r4.js.map +0 -1
- package/dist/components/p-BC5-_yPs.js +0 -75
- package/dist/components/p-BC5-_yPs.js.map +0 -1
- package/dist/components/p-BUsg2vtg.js +0 -14897
- package/dist/components/p-BUsg2vtg.js.map +0 -1
- package/dist/components/p-Bo-NQ68K.js +0 -132
- package/dist/components/p-Bo-NQ68K.js.map +0 -1
- package/dist/components/p-C6qB08BS.js.map +0 -1
- package/dist/components/p-C720oASC.js +0 -201
- package/dist/components/p-C720oASC.js.map +0 -1
- package/dist/components/p-C92UCXyc.js +0 -308
- package/dist/components/p-C92UCXyc.js.map +0 -1
- package/dist/components/p-CAxHKvww.js +0 -119
- package/dist/components/p-CAxHKvww.js.map +0 -1
- package/dist/components/p-CD9cCvhR.js +0 -272
- package/dist/components/p-CD9cCvhR.js.map +0 -1
- package/dist/components/p-CIlIrPRp.js +0 -83
- package/dist/components/p-CIlIrPRp.js.map +0 -1
- package/dist/components/p-CIts5Uma.js +0 -110
- package/dist/components/p-CIts5Uma.js.map +0 -1
- package/dist/components/p-Cdw55iW6.js +0 -281
- package/dist/components/p-Cdw55iW6.js.map +0 -1
- package/dist/components/p-CwkUrTy1.js +0 -1367
- package/dist/components/p-CwkUrTy1.js.map +0 -1
- package/dist/components/p-D8W6LE-c.js.map +0 -1
- package/dist/components/p-DI7JQMsC.js +0 -46
- package/dist/components/p-DI7JQMsC.js.map +0 -1
- package/dist/components/p-DmYjCy-z.js +0 -62
- package/dist/components/p-DmYjCy-z.js.map +0 -1
- package/dist/components/p-DoD6F7Y4.js +0 -157
- package/dist/components/p-DoD6F7Y4.js.map +0 -1
- package/dist/components/p-DyVWaSSc.js +0 -55
- package/dist/components/p-DyVWaSSc.js.map +0 -1
- package/dist/components/p-WLXyD_eY.js +0 -111
- package/dist/components/p-WLXyD_eY.js.map +0 -1
- package/dist/components/p-c7AGmG3p.js +0 -73
- package/dist/components/p-c7AGmG3p.js.map +0 -1
- package/dist/components/p-fm-bG_zL.js +0 -231
- package/dist/components/p-fm-bG_zL.js.map +0 -1
- package/dist/components/p-fqLbEfE0.js +0 -39586
- package/dist/components/p-fqLbEfE0.js.map +0 -1
- package/dist/components/p-l10It7Nm.js.map +0 -1
- package/dist/components/p-n789Y3S-.js.map +0 -1
- package/dist/components/p-qWf2T62p.js +0 -57
- package/dist/components/p-qWf2T62p.js.map +0 -1
- package/dist/components/p-vLN8eXFe.js +0 -106
- package/dist/components/p-vLN8eXFe.js.map +0 -1
- package/dist/esm/app-globals-DQuL1Twl.js.map +0 -1
- package/dist/esm/default-line-tool.config-CuBm2vpW.js.map +0 -1
- package/dist/esm/index-SGde3HXB.js +0 -1623
- package/dist/esm/index-SGde3HXB.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/kritzel-brush-style.entry.js.map +0 -1
- package/dist/esm/loader.js.map +0 -1
- package/dist/esm/stencil.js.map +0 -1
- package/dist/stencil/index.esm.js.map +0 -1
- package/dist/stencil/kritzel-brush-style.entry.esm.js.map +0 -1
- package/dist/stencil/loader.esm.js.map +0 -1
- package/dist/stencil/p-0a9b6696.entry.js +0 -2
- package/dist/stencil/p-0a9b6696.entry.js.map +0 -1
- package/dist/stencil/p-0fdce6ce.entry.js +0 -10
- package/dist/stencil/p-0fdce6ce.entry.js.map +0 -1
- package/dist/stencil/p-CuBm2vpW.js +0 -2
- package/dist/stencil/p-CuBm2vpW.js.map +0 -1
- package/dist/stencil/p-DQuL1Twl.js.map +0 -1
- package/dist/stencil/p-SGde3HXB.js +0 -3
- package/dist/stencil/p-SGde3HXB.js.map +0 -1
- package/dist/stencil/stencil.esm.js.map +0 -1
package/dist/esm/{default-line-tool.config-CuBm2vpW.js → default-line-tool.config-CD5sTKH-.js}
RENAMED
|
@@ -3028,7 +3028,7 @@ creating and deserializing such documents.
|
|
|
3028
3028
|
When given, the type parameters provide the names of the nodes and
|
|
3029
3029
|
marks in this schema.
|
|
3030
3030
|
*/
|
|
3031
|
-
class Schema {
|
|
3031
|
+
let Schema$1 = class Schema {
|
|
3032
3032
|
/**
|
|
3033
3033
|
Construct a schema from a schema [specification](https://prosemirror.net/docs/ref/#model.SchemaSpec).
|
|
3034
3034
|
*/
|
|
@@ -3120,7 +3120,7 @@ class Schema {
|
|
|
3120
3120
|
throw new RangeError("Unknown node type: " + name);
|
|
3121
3121
|
return found;
|
|
3122
3122
|
}
|
|
3123
|
-
}
|
|
3123
|
+
};
|
|
3124
3124
|
function gatherMarks(schema, marks) {
|
|
3125
3125
|
let found = [];
|
|
3126
3126
|
for (let i = 0; i < marks.length; i++) {
|
|
@@ -3887,7 +3887,7 @@ class DOMSerializer {
|
|
|
3887
3887
|
*/
|
|
3888
3888
|
serializeFragment(fragment, options = {}, target) {
|
|
3889
3889
|
if (!target)
|
|
3890
|
-
target = doc$
|
|
3890
|
+
target = doc$2(options).createDocumentFragment();
|
|
3891
3891
|
let top = target, active = [];
|
|
3892
3892
|
fragment.forEach(node => {
|
|
3893
3893
|
if (active.length || node.marks.length) {
|
|
@@ -3923,7 +3923,7 @@ class DOMSerializer {
|
|
|
3923
3923
|
@internal
|
|
3924
3924
|
*/
|
|
3925
3925
|
serializeNodeInner(node, options) {
|
|
3926
|
-
let { dom, contentDOM } = renderSpec(doc$
|
|
3926
|
+
let { dom, contentDOM } = renderSpec(doc$2(options), this.nodes[node.type.name](node), null, node.attrs);
|
|
3927
3927
|
if (contentDOM) {
|
|
3928
3928
|
if (node.isLeaf)
|
|
3929
3929
|
throw new RangeError("Content hole not allowed in a leaf node spec");
|
|
@@ -3954,7 +3954,7 @@ class DOMSerializer {
|
|
|
3954
3954
|
*/
|
|
3955
3955
|
serializeMark(mark, inline, options = {}) {
|
|
3956
3956
|
let toDOM = this.marks[mark.type.name];
|
|
3957
|
-
return toDOM && renderSpec(doc$
|
|
3957
|
+
return toDOM && renderSpec(doc$2(options), toDOM(mark, inline), null, mark.attrs);
|
|
3958
3958
|
}
|
|
3959
3959
|
static renderSpec(doc, structure, xmlNS = null, blockArraysIn) {
|
|
3960
3960
|
return renderSpec(doc, structure, xmlNS, blockArraysIn);
|
|
@@ -3993,7 +3993,7 @@ function gatherToDOM(obj) {
|
|
|
3993
3993
|
}
|
|
3994
3994
|
return result;
|
|
3995
3995
|
}
|
|
3996
|
-
function doc$
|
|
3996
|
+
function doc$2(options) {
|
|
3997
3997
|
return options.document || window.document;
|
|
3998
3998
|
}
|
|
3999
3999
|
const suspiciousAttributeCache = new WeakMap();
|
|
@@ -7307,7 +7307,7 @@ function caretFromPoint(doc, x, y) {
|
|
|
7307
7307
|
}
|
|
7308
7308
|
|
|
7309
7309
|
const nav = typeof navigator != "undefined" ? navigator : null;
|
|
7310
|
-
const doc = typeof document != "undefined" ? document : null;
|
|
7310
|
+
const doc$1 = typeof document != "undefined" ? document : null;
|
|
7311
7311
|
const agent = (nav && nav.userAgent) || "";
|
|
7312
7312
|
const ie_edge = /Edge\/(\d+)/.exec(agent);
|
|
7313
7313
|
const ie_upto10 = /MSIE \d/.exec(agent);
|
|
@@ -7324,7 +7324,7 @@ const ios = safari && (/Mobile\/\w+/.test(agent) || !!nav && nav.maxTouchPoints
|
|
|
7324
7324
|
const mac$3 = ios || (nav ? /Mac/.test(nav.platform) : false);
|
|
7325
7325
|
const windows$1 = nav ? /Win/.test(nav.platform) : false;
|
|
7326
7326
|
const android = /Android \d/.test(agent);
|
|
7327
|
-
const webkit = !!doc && "webkitFontSmoothing" in doc.documentElement.style;
|
|
7327
|
+
const webkit = !!doc$1 && "webkitFontSmoothing" in doc$1.documentElement.style;
|
|
7328
7328
|
const webkit_version = webkit ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
|
|
7329
7329
|
|
|
7330
7330
|
function windowRect(doc) {
|
|
@@ -7510,17 +7510,20 @@ function findOffsetInNode(node, coords) {
|
|
|
7510
7510
|
}
|
|
7511
7511
|
function findOffsetInText(node, coords) {
|
|
7512
7512
|
let len = node.nodeValue.length;
|
|
7513
|
-
let range = document.createRange();
|
|
7513
|
+
let range = document.createRange(), result;
|
|
7514
7514
|
for (let i = 0; i < len; i++) {
|
|
7515
7515
|
range.setEnd(node, i + 1);
|
|
7516
7516
|
range.setStart(node, i);
|
|
7517
7517
|
let rect = singleRect(range, 1);
|
|
7518
7518
|
if (rect.top == rect.bottom)
|
|
7519
7519
|
continue;
|
|
7520
|
-
if (inRect(coords, rect))
|
|
7521
|
-
|
|
7520
|
+
if (inRect(coords, rect)) {
|
|
7521
|
+
result = { node, offset: i + (coords.left >= (rect.left + rect.right) / 2 ? 1 : 0) };
|
|
7522
|
+
break;
|
|
7523
|
+
}
|
|
7522
7524
|
}
|
|
7523
|
-
|
|
7525
|
+
range.detach();
|
|
7526
|
+
return result || { node, offset: 0 };
|
|
7524
7527
|
}
|
|
7525
7528
|
function inRect(coords, rect) {
|
|
7526
7529
|
return coords.left >= rect.left - 1 && coords.left <= rect.right + 1 &&
|
|
@@ -10613,7 +10616,8 @@ editHandlers.compositionstart = editHandlers.compositionupdate = view => {
|
|
|
10613
10616
|
let { state } = view, $pos = state.selection.$to;
|
|
10614
10617
|
if (state.selection instanceof TextSelection &&
|
|
10615
10618
|
(state.storedMarks ||
|
|
10616
|
-
(!$pos.textOffset && $pos.parentOffset && $pos.nodeBefore.marks.some(m => m.type.spec.inclusive === false))
|
|
10619
|
+
(!$pos.textOffset && $pos.parentOffset && $pos.nodeBefore.marks.some(m => m.type.spec.inclusive === false)) ||
|
|
10620
|
+
chrome && windows$1 && selectionBeforeUneditable(view))) { // Issue #1500
|
|
10617
10621
|
// Need to wrap the cursor in mark nodes different from the ones in the DOM context
|
|
10618
10622
|
view.markCursor = view.state.storedMarks || $pos.marks();
|
|
10619
10623
|
endComposition(view, true);
|
|
@@ -10647,6 +10651,13 @@ editHandlers.compositionstart = editHandlers.compositionupdate = view => {
|
|
|
10647
10651
|
}
|
|
10648
10652
|
scheduleComposeEnd(view, timeoutComposition);
|
|
10649
10653
|
};
|
|
10654
|
+
function selectionBeforeUneditable(view) {
|
|
10655
|
+
let { focusNode, focusOffset } = view.domSelectionRange();
|
|
10656
|
+
if (!focusNode || focusNode.nodeType != 1 || focusOffset >= focusNode.childNodes.length)
|
|
10657
|
+
return false;
|
|
10658
|
+
let next = focusNode.childNodes[focusOffset];
|
|
10659
|
+
return next.nodeType == 1 && next.contentEditable == "false";
|
|
10660
|
+
}
|
|
10650
10661
|
editHandlers.compositionend = (view, event) => {
|
|
10651
10662
|
if (view.composing) {
|
|
10652
10663
|
view.input.composing = false;
|
|
@@ -10874,10 +10885,15 @@ handlers.dragend = view => {
|
|
|
10874
10885
|
}, 50);
|
|
10875
10886
|
};
|
|
10876
10887
|
editHandlers.dragover = editHandlers.dragenter = (_, e) => e.preventDefault();
|
|
10877
|
-
editHandlers.drop = (view,
|
|
10878
|
-
|
|
10879
|
-
|
|
10880
|
-
|
|
10888
|
+
editHandlers.drop = (view, event) => {
|
|
10889
|
+
try {
|
|
10890
|
+
handleDrop(view, event, view.dragging);
|
|
10891
|
+
}
|
|
10892
|
+
finally {
|
|
10893
|
+
view.dragging = null;
|
|
10894
|
+
}
|
|
10895
|
+
};
|
|
10896
|
+
function handleDrop(view, event, dragging) {
|
|
10881
10897
|
if (!event.dataTransfer)
|
|
10882
10898
|
return;
|
|
10883
10899
|
let eventPos = view.posAtCoords(eventCoords(event));
|
|
@@ -10931,7 +10947,7 @@ editHandlers.drop = (view, _event) => {
|
|
|
10931
10947
|
}
|
|
10932
10948
|
view.focus();
|
|
10933
10949
|
view.dispatch(tr.setMeta("uiEvent", "drop"));
|
|
10934
|
-
}
|
|
10950
|
+
}
|
|
10935
10951
|
handlers.focus = view => {
|
|
10936
10952
|
view.input.lastFocus = Date.now();
|
|
10937
10953
|
if (!view.focused) {
|
|
@@ -11857,6 +11873,17 @@ class DOMObserver {
|
|
|
11857
11873
|
}
|
|
11858
11874
|
}
|
|
11859
11875
|
}
|
|
11876
|
+
else if ((chrome || safari) && added.some(n => n.nodeName == "BR") &&
|
|
11877
|
+
(view.input.lastKeyCode == 8 || view.input.lastKeyCode == 46)) {
|
|
11878
|
+
// Chrome/Safari sometimes insert a bogus break node if you
|
|
11879
|
+
// backspace out the last bit of text before an inline-flex node (#1552)
|
|
11880
|
+
for (let node of added)
|
|
11881
|
+
if (node.nodeName == "BR" && node.parentNode) {
|
|
11882
|
+
let after = node.nextSibling;
|
|
11883
|
+
if (after && after.nodeType == 1 && after.contentEditable == "false")
|
|
11884
|
+
node.parentNode.removeChild(node);
|
|
11885
|
+
}
|
|
11886
|
+
}
|
|
11860
11887
|
let readSel = null;
|
|
11861
11888
|
// If it looks like the browser has reset the selection to the
|
|
11862
11889
|
// start of the document after focus, restore the selection from
|
|
@@ -13131,7 +13158,7 @@ module.
|
|
|
13131
13158
|
To reuse elements from this schema, extend or read from its
|
|
13132
13159
|
`spec.nodes` and `spec.marks` [properties](https://prosemirror.net/docs/ref/#model.Schema.spec).
|
|
13133
13160
|
*/
|
|
13134
|
-
const schema = new Schema({ nodes, marks });
|
|
13161
|
+
const schema = new Schema$1({ nodes, marks });
|
|
13135
13162
|
|
|
13136
13163
|
const olDOM = ["ol", 0], ulDOM = ["ul", 0], liDOM = ["li", 0];
|
|
13137
13164
|
/**
|
|
@@ -13959,7 +13986,7 @@ class KritzelText extends KritzelBaseObject {
|
|
|
13959
13986
|
isEditing = false;
|
|
13960
13987
|
editor = null;
|
|
13961
13988
|
content = null;
|
|
13962
|
-
_schema = new Schema({
|
|
13989
|
+
_schema = new Schema$1({
|
|
13963
13990
|
nodes: addListNodes(schema.spec.nodes, 'paragraph block*', 'block'),
|
|
13964
13991
|
marks: schema.spec.marks,
|
|
13965
13992
|
});
|
|
@@ -18147,6 +18174,12 @@ class KritzelSelectionTool extends KritzelBaseTool {
|
|
|
18147
18174
|
* @module map
|
|
18148
18175
|
*/
|
|
18149
18176
|
|
|
18177
|
+
/**
|
|
18178
|
+
* @template K
|
|
18179
|
+
* @template V
|
|
18180
|
+
* @typedef {Map<K,V>} GlobalMap
|
|
18181
|
+
*/
|
|
18182
|
+
|
|
18150
18183
|
/**
|
|
18151
18184
|
* Creates a new Map instance.
|
|
18152
18185
|
*
|
|
@@ -18282,6 +18315,25 @@ const appendTo = (dest, src) => {
|
|
|
18282
18315
|
*/
|
|
18283
18316
|
const from$1 = Array.from;
|
|
18284
18317
|
|
|
18318
|
+
/**
|
|
18319
|
+
* True iff condition holds on every element in the Array.
|
|
18320
|
+
*
|
|
18321
|
+
* @function
|
|
18322
|
+
* @template {ArrayLike<any>} ARR
|
|
18323
|
+
*
|
|
18324
|
+
* @param {ARR} arr
|
|
18325
|
+
* @param {ARR extends ArrayLike<infer S> ? ((value:S, index:number, arr:ARR) => boolean) : any} f
|
|
18326
|
+
* @return {boolean}
|
|
18327
|
+
*/
|
|
18328
|
+
const every$1 = (arr, f) => {
|
|
18329
|
+
for (let i = 0; i < arr.length; i++) {
|
|
18330
|
+
if (!f(arr[i], i, arr)) {
|
|
18331
|
+
return false
|
|
18332
|
+
}
|
|
18333
|
+
}
|
|
18334
|
+
return true
|
|
18335
|
+
};
|
|
18336
|
+
|
|
18285
18337
|
/**
|
|
18286
18338
|
* True iff condition holds on some element in the Array.
|
|
18287
18339
|
*
|
|
@@ -18301,6 +18353,20 @@ const some = (arr, f) => {
|
|
|
18301
18353
|
return false
|
|
18302
18354
|
};
|
|
18303
18355
|
|
|
18356
|
+
/**
|
|
18357
|
+
* @template T
|
|
18358
|
+
* @param {number} len
|
|
18359
|
+
* @param {function(number, Array<T>):T} f
|
|
18360
|
+
* @return {Array<T>}
|
|
18361
|
+
*/
|
|
18362
|
+
const unfold = (len, f) => {
|
|
18363
|
+
const array = new Array(len);
|
|
18364
|
+
for (let i = 0; i < len; i++) {
|
|
18365
|
+
array[i] = f(i, array);
|
|
18366
|
+
}
|
|
18367
|
+
return array
|
|
18368
|
+
};
|
|
18369
|
+
|
|
18304
18370
|
const isArray = Array.isArray;
|
|
18305
18371
|
|
|
18306
18372
|
/**
|
|
@@ -18490,8 +18556,10 @@ const max$2 = (a, b) => a > b ? a : b;
|
|
|
18490
18556
|
const pow = Math.pow;
|
|
18491
18557
|
|
|
18492
18558
|
/**
|
|
18559
|
+
* Check whether n is negative, while considering the -0 edge case. While `-0 < 0` is false, this
|
|
18560
|
+
* function returns true for -0,-1,,.. and returns false for 0,1,2,...
|
|
18493
18561
|
* @param {number} n
|
|
18494
|
-
* @return {boolean} Wether n is negative. This function also
|
|
18562
|
+
* @return {boolean} Wether n is negative. This function also distinguishes between -0 and +0
|
|
18495
18563
|
*/
|
|
18496
18564
|
const isNegativeZero = n => n !== 0 ? n < 0 : 1 / n < 0;
|
|
18497
18565
|
|
|
@@ -18531,6 +18599,7 @@ const BITS31 = 0x7FFFFFFF;
|
|
|
18531
18599
|
|
|
18532
18600
|
|
|
18533
18601
|
const MAX_SAFE_INTEGER$2 = Number.MAX_SAFE_INTEGER;
|
|
18602
|
+
const MIN_SAFE_INTEGER = Number.MIN_SAFE_INTEGER;
|
|
18534
18603
|
|
|
18535
18604
|
/* c8 ignore next */
|
|
18536
18605
|
const isInteger = Number.isInteger || (num => typeof num === 'number' && isFinite(num) && floor$2(num) === num);
|
|
@@ -18568,7 +18637,7 @@ const fromCamelCase = (s, separator) => trimLeft(s.replace(fromCamelCaseRegex, m
|
|
|
18568
18637
|
|
|
18569
18638
|
/**
|
|
18570
18639
|
* @param {string} str
|
|
18571
|
-
* @return {Uint8Array}
|
|
18640
|
+
* @return {Uint8Array<ArrayBuffer>}
|
|
18572
18641
|
*/
|
|
18573
18642
|
const _encodeUtf8Polyfill$2 = str => {
|
|
18574
18643
|
const encodedString = unescape(encodeURIComponent(str));
|
|
@@ -18585,7 +18654,7 @@ const utf8TextEncoder$2 = /** @type {TextEncoder} */ (typeof TextEncoder !== 'un
|
|
|
18585
18654
|
|
|
18586
18655
|
/**
|
|
18587
18656
|
* @param {string} str
|
|
18588
|
-
* @return {Uint8Array}
|
|
18657
|
+
* @return {Uint8Array<ArrayBuffer>}
|
|
18589
18658
|
*/
|
|
18590
18659
|
const _encodeUtf8Native$2 = str => utf8TextEncoder$2.encode(str);
|
|
18591
18660
|
|
|
@@ -18610,6 +18679,12 @@ if (utf8TextDecoder$2 && utf8TextDecoder$2.decode(new Uint8Array()).length === 1
|
|
|
18610
18679
|
utf8TextDecoder$2 = null;
|
|
18611
18680
|
}
|
|
18612
18681
|
|
|
18682
|
+
/**
|
|
18683
|
+
* @param {string} source
|
|
18684
|
+
* @param {number} n
|
|
18685
|
+
*/
|
|
18686
|
+
const repeat = (source, n) => unfold(n, () => source).join('');
|
|
18687
|
+
|
|
18613
18688
|
/**
|
|
18614
18689
|
* Efficient schema-less binary encoding with support for variable length encoding.
|
|
18615
18690
|
*
|
|
@@ -18666,7 +18741,7 @@ const createEncoder$1 = () => new Encoder$1();
|
|
|
18666
18741
|
* @param {Encoder} encoder
|
|
18667
18742
|
* @return {number}
|
|
18668
18743
|
*/
|
|
18669
|
-
const length$
|
|
18744
|
+
const length$2 = encoder => {
|
|
18670
18745
|
let len = encoder.cpos;
|
|
18671
18746
|
for (let i = 0; i < encoder.bufs.length; i++) {
|
|
18672
18747
|
len += encoder.bufs[i].length;
|
|
@@ -18679,10 +18754,10 @@ const length$3 = encoder => {
|
|
|
18679
18754
|
*
|
|
18680
18755
|
* @function
|
|
18681
18756
|
* @param {Encoder} encoder
|
|
18682
|
-
* @return {Uint8Array} The created ArrayBuffer.
|
|
18757
|
+
* @return {Uint8Array<ArrayBuffer>} The created ArrayBuffer.
|
|
18683
18758
|
*/
|
|
18684
18759
|
const toUint8Array$1 = encoder => {
|
|
18685
|
-
const uint8arr = new Uint8Array(length$
|
|
18760
|
+
const uint8arr = new Uint8Array(length$2(encoder));
|
|
18686
18761
|
let curPos = 0;
|
|
18687
18762
|
for (let i = 0; i < encoder.bufs.length; i++) {
|
|
18688
18763
|
const d = encoder.bufs[i];
|
|
@@ -18920,6 +18995,14 @@ const isFloat32 = num => {
|
|
|
18920
18995
|
return floatTestBed.getFloat32(0) === num
|
|
18921
18996
|
};
|
|
18922
18997
|
|
|
18998
|
+
/**
|
|
18999
|
+
* @typedef {Array<AnyEncodable>} AnyEncodableArray
|
|
19000
|
+
*/
|
|
19001
|
+
|
|
19002
|
+
/**
|
|
19003
|
+
* @typedef {undefined|null|number|bigint|boolean|string|{[k:string]:AnyEncodable}|AnyEncodableArray|Uint8Array} AnyEncodable
|
|
19004
|
+
*/
|
|
19005
|
+
|
|
18923
19006
|
/**
|
|
18924
19007
|
* Encode data with efficient binary format.
|
|
18925
19008
|
*
|
|
@@ -18955,7 +19038,7 @@ const isFloat32 = num => {
|
|
|
18955
19038
|
* lib0/encoding.js
|
|
18956
19039
|
*
|
|
18957
19040
|
* @param {Encoder} encoder
|
|
18958
|
-
* @param {
|
|
19041
|
+
* @param {AnyEncodable} data
|
|
18959
19042
|
*/
|
|
18960
19043
|
const writeAny = (encoder, data) => {
|
|
18961
19044
|
switch (typeof data) {
|
|
@@ -19309,16 +19392,17 @@ const errorIntegerOutOfRange$2 = create$7('Integer out of Range');
|
|
|
19309
19392
|
|
|
19310
19393
|
/**
|
|
19311
19394
|
* A Decoder handles the decoding of an Uint8Array.
|
|
19395
|
+
* @template {ArrayBufferLike} [Buf=ArrayBufferLike]
|
|
19312
19396
|
*/
|
|
19313
19397
|
let Decoder$1 = class Decoder {
|
|
19314
19398
|
/**
|
|
19315
|
-
* @param {Uint8Array} uint8Array Binary data to decode
|
|
19399
|
+
* @param {Uint8Array<Buf>} uint8Array Binary data to decode
|
|
19316
19400
|
*/
|
|
19317
19401
|
constructor (uint8Array) {
|
|
19318
19402
|
/**
|
|
19319
19403
|
* Decoding target.
|
|
19320
19404
|
*
|
|
19321
|
-
* @type {Uint8Array}
|
|
19405
|
+
* @type {Uint8Array<Buf>}
|
|
19322
19406
|
*/
|
|
19323
19407
|
this.arr = uint8Array;
|
|
19324
19408
|
/**
|
|
@@ -19332,8 +19416,9 @@ let Decoder$1 = class Decoder {
|
|
|
19332
19416
|
|
|
19333
19417
|
/**
|
|
19334
19418
|
* @function
|
|
19335
|
-
* @
|
|
19336
|
-
* @
|
|
19419
|
+
* @template {ArrayBufferLike} Buf
|
|
19420
|
+
* @param {Uint8Array<Buf>} uint8Array
|
|
19421
|
+
* @return {Decoder<Buf>}
|
|
19337
19422
|
*/
|
|
19338
19423
|
const createDecoder$1 = uint8Array => new Decoder$1(uint8Array);
|
|
19339
19424
|
|
|
@@ -19351,9 +19436,10 @@ const hasContent = decoder => decoder.pos !== decoder.arr.length;
|
|
|
19351
19436
|
* Use `buffer.copyUint8Array` to copy the result into a new Uint8Array.
|
|
19352
19437
|
*
|
|
19353
19438
|
* @function
|
|
19354
|
-
* @
|
|
19439
|
+
* @template {ArrayBufferLike} Buf
|
|
19440
|
+
* @param {Decoder<Buf>} decoder The decoder instance
|
|
19355
19441
|
* @param {number} len The length of bytes to read
|
|
19356
|
-
* @return {Uint8Array}
|
|
19442
|
+
* @return {Uint8Array<Buf>}
|
|
19357
19443
|
*/
|
|
19358
19444
|
const readUint8Array$2 = (decoder, len) => {
|
|
19359
19445
|
const view = new Uint8Array(decoder.arr.buffer, decoder.pos + decoder.arr.byteOffset, len);
|
|
@@ -19368,8 +19454,9 @@ const readUint8Array$2 = (decoder, len) => {
|
|
|
19368
19454
|
* Use `buffer.copyUint8Array` to copy the result into a new Uint8Array.
|
|
19369
19455
|
*
|
|
19370
19456
|
* @function
|
|
19371
|
-
* @
|
|
19372
|
-
* @
|
|
19457
|
+
* @template {ArrayBufferLike} Buf
|
|
19458
|
+
* @param {Decoder<Buf>} decoder
|
|
19459
|
+
* @return {Uint8Array<Buf>}
|
|
19373
19460
|
*/
|
|
19374
19461
|
const readVarUint8Array$2 = decoder => readUint8Array$2(decoder, readVarUint$2(decoder));
|
|
19375
19462
|
|
|
@@ -19857,12 +19944,38 @@ const onChange = eventHandler => usePolyfill || addEventListener('storage', /**
|
|
|
19857
19944
|
/* c8 ignore next */
|
|
19858
19945
|
const offChange = eventHandler => usePolyfill || removeEventListener('storage', /** @type {any} */ (eventHandler));
|
|
19859
19946
|
|
|
19947
|
+
const EqualityTraitSymbol = Symbol('Equality');
|
|
19948
|
+
|
|
19949
|
+
/**
|
|
19950
|
+
* @typedef {{ [EqualityTraitSymbol]:(other:EqualityTrait)=>boolean }} EqualityTrait
|
|
19951
|
+
*/
|
|
19952
|
+
|
|
19860
19953
|
/**
|
|
19861
|
-
* Utility functions for working with EcmaScript objects.
|
|
19862
19954
|
*
|
|
19863
|
-
*
|
|
19955
|
+
* Utility function to compare any two objects.
|
|
19956
|
+
*
|
|
19957
|
+
* Note that it is expected that the first parameter is more specific than the latter one.
|
|
19958
|
+
*
|
|
19959
|
+
* @example js
|
|
19960
|
+
* class X { [traits.EqualityTraitSymbol] (other) { return other === this } }
|
|
19961
|
+
* class X2 { [traits.EqualityTraitSymbol] (other) { return other === this }, x2 () { return 2 } }
|
|
19962
|
+
* // this is fine
|
|
19963
|
+
* traits.equals(new X2(), new X())
|
|
19964
|
+
* // this is not, because the left type is less specific than the right one
|
|
19965
|
+
* traits.equals(new X(), new X2())
|
|
19966
|
+
*
|
|
19967
|
+
* @template {EqualityTrait} T
|
|
19968
|
+
* @param {NoInfer<T>} a
|
|
19969
|
+
* @param {T} b
|
|
19970
|
+
* @return {boolean}
|
|
19864
19971
|
*/
|
|
19972
|
+
const equals = (a, b) => a === b || !!a?.[EqualityTraitSymbol]?.(b) || false;
|
|
19865
19973
|
|
|
19974
|
+
/**
|
|
19975
|
+
* @param {any} o
|
|
19976
|
+
* @return {o is { [k:string]:any }}
|
|
19977
|
+
*/
|
|
19978
|
+
const isObject = o => typeof o === 'object';
|
|
19866
19979
|
|
|
19867
19980
|
/**
|
|
19868
19981
|
* Object.assign
|
|
@@ -19901,13 +20014,6 @@ const map = (obj, f) => {
|
|
|
19901
20014
|
return results
|
|
19902
20015
|
};
|
|
19903
20016
|
|
|
19904
|
-
/**
|
|
19905
|
-
* @deprecated use object.size instead
|
|
19906
|
-
* @param {Object<string,any>} obj
|
|
19907
|
-
* @return {number}
|
|
19908
|
-
*/
|
|
19909
|
-
const length$2 = obj => keys$1(obj).length;
|
|
19910
|
-
|
|
19911
20017
|
/**
|
|
19912
20018
|
* @param {Object<string,any>} obj
|
|
19913
20019
|
* @return {number}
|
|
@@ -19954,7 +20060,7 @@ const hasProperty$1 = (obj, key) => Object.prototype.hasOwnProperty.call(obj, ke
|
|
|
19954
20060
|
* @param {Object<string,any>} b
|
|
19955
20061
|
* @return {boolean}
|
|
19956
20062
|
*/
|
|
19957
|
-
const equalFlat = (a, b) => a === b || (size(a) === size(b) && every(a, (val, key) => (val !== undefined || hasProperty$1(b, key)) && b[key]
|
|
20063
|
+
const equalFlat = (a, b) => a === b || (size(a) === size(b) && every(a, (val, key) => (val !== undefined || hasProperty$1(b, key)) && equals(b[key], val)));
|
|
19958
20064
|
|
|
19959
20065
|
/**
|
|
19960
20066
|
* Make an object immutable. This hurts performance and is usually not needed if you perform good
|
|
@@ -19980,12 +20086,6 @@ const deepFreeze = (o) => {
|
|
|
19980
20086
|
return freeze(o)
|
|
19981
20087
|
};
|
|
19982
20088
|
|
|
19983
|
-
const EqualityTraitSymbol = Symbol('Equality');
|
|
19984
|
-
|
|
19985
|
-
/**
|
|
19986
|
-
* @typedef {{ [EqualityTraitSymbol]:(other:EqualityTrait)=>boolean }} EqualityTrait
|
|
19987
|
-
*/
|
|
19988
|
-
|
|
19989
20089
|
/**
|
|
19990
20090
|
* Common functions and function call helpers.
|
|
19991
20091
|
*
|
|
@@ -20030,7 +20130,7 @@ const equalityDeep$1 = (a, b) => {
|
|
|
20030
20130
|
if (a === b) {
|
|
20031
20131
|
return true
|
|
20032
20132
|
}
|
|
20033
|
-
if (a == null || b == null || a.constructor !== b.constructor) {
|
|
20133
|
+
if (a == null || b == null || (a.constructor !== b.constructor && (a.constructor || Object) !== (b.constructor || Object))) {
|
|
20034
20134
|
return false
|
|
20035
20135
|
}
|
|
20036
20136
|
if (a[EqualityTraitSymbol] != null) {
|
|
@@ -20074,8 +20174,9 @@ const equalityDeep$1 = (a, b) => {
|
|
|
20074
20174
|
}
|
|
20075
20175
|
break
|
|
20076
20176
|
}
|
|
20177
|
+
case undefined:
|
|
20077
20178
|
case Object:
|
|
20078
|
-
if (
|
|
20179
|
+
if (size(a) !== size(b)) {
|
|
20079
20180
|
return false
|
|
20080
20181
|
}
|
|
20081
20182
|
for (const key in a) {
|
|
@@ -20197,7 +20298,7 @@ const hasConf = (name) =>
|
|
|
20197
20298
|
hasParam('--' + name) || getVariable(name) !== null;
|
|
20198
20299
|
|
|
20199
20300
|
/* c8 ignore next */
|
|
20200
|
-
hasConf('production');
|
|
20301
|
+
const production = hasConf('production');
|
|
20201
20302
|
|
|
20202
20303
|
/* c8 ignore next 2 */
|
|
20203
20304
|
const forceColor = isNode &&
|
|
@@ -20275,7 +20376,7 @@ const toBase64Node = bytes => Buffer.from(bytes.buffer, bytes.byteOffset, bytes.
|
|
|
20275
20376
|
/* c8 ignore start */
|
|
20276
20377
|
/**
|
|
20277
20378
|
* @param {string} s
|
|
20278
|
-
* @return {Uint8Array}
|
|
20379
|
+
* @return {Uint8Array<ArrayBuffer>}
|
|
20279
20380
|
*/
|
|
20280
20381
|
const fromBase64Browser = s => {
|
|
20281
20382
|
// eslint-disable-next-line no-undef
|
|
@@ -20342,182 +20443,1396 @@ class Pair {
|
|
|
20342
20443
|
*/
|
|
20343
20444
|
const create$5 = (left, right) => new Pair(left, right);
|
|
20344
20445
|
|
|
20345
|
-
|
|
20446
|
+
/**
|
|
20447
|
+
* Fast Pseudo Random Number Generators.
|
|
20448
|
+
*
|
|
20449
|
+
* Given a seed a PRNG generates a sequence of numbers that cannot be reasonably predicted.
|
|
20450
|
+
* Two PRNGs must generate the same random sequence of numbers if given the same seed.
|
|
20451
|
+
*
|
|
20452
|
+
* @module prng
|
|
20453
|
+
*/
|
|
20346
20454
|
|
|
20347
20455
|
|
|
20348
|
-
/**
|
|
20456
|
+
/**
|
|
20457
|
+
* Generates a single random bool.
|
|
20458
|
+
*
|
|
20459
|
+
* @param {PRNG} gen A random number generator.
|
|
20460
|
+
* @return {Boolean} A random boolean
|
|
20461
|
+
*/
|
|
20462
|
+
const bool = gen => (gen.next() >= 0.5);
|
|
20349
20463
|
|
|
20350
20464
|
/**
|
|
20351
|
-
*
|
|
20352
|
-
*
|
|
20465
|
+
* Generates a random integer with 53 bit resolution.
|
|
20466
|
+
*
|
|
20467
|
+
* @param {PRNG} gen A random number generator.
|
|
20468
|
+
* @param {Number} min The lower bound of the allowed return values (inclusive).
|
|
20469
|
+
* @param {Number} max The upper bound of the allowed return values (inclusive).
|
|
20470
|
+
* @return {Number} A random integer on [min, max]
|
|
20353
20471
|
*/
|
|
20354
|
-
const
|
|
20355
|
-
/* c8 ignore stop */
|
|
20472
|
+
const int53 = (gen, min, max) => floor$2(gen.next() * (max + 1 - min) + min);
|
|
20356
20473
|
|
|
20357
20474
|
/**
|
|
20358
|
-
*
|
|
20475
|
+
* Generates a random integer with 32 bit resolution.
|
|
20359
20476
|
*
|
|
20360
|
-
* @
|
|
20477
|
+
* @param {PRNG} gen A random number generator.
|
|
20478
|
+
* @param {Number} min The lower bound of the allowed return values (inclusive).
|
|
20479
|
+
* @param {Number} max The upper bound of the allowed return values (inclusive).
|
|
20480
|
+
* @return {Number} A random integer on [min, max]
|
|
20361
20481
|
*/
|
|
20482
|
+
const int32 = (gen, min, max) => floor$2(gen.next() * (max + 1 - min) + min);
|
|
20362
20483
|
|
|
20363
20484
|
/**
|
|
20364
|
-
*
|
|
20485
|
+
* @deprecated
|
|
20486
|
+
* Optimized version of prng.int32. It has the same precision as prng.int32, but should be preferred when
|
|
20487
|
+
* openaring on smaller ranges.
|
|
20488
|
+
*
|
|
20489
|
+
* @param {PRNG} gen A random number generator.
|
|
20490
|
+
* @param {Number} min The lower bound of the allowed return values (inclusive).
|
|
20491
|
+
* @param {Number} max The upper bound of the allowed return values (inclusive). The max inclusive number is `binary.BITS31-1`
|
|
20492
|
+
* @return {Number} A random integer on [min, max]
|
|
20365
20493
|
*/
|
|
20366
|
-
const
|
|
20494
|
+
const int31 = (gen, min, max) => int32(gen, min, max);
|
|
20367
20495
|
|
|
20368
|
-
|
|
20369
|
-
|
|
20370
|
-
|
|
20371
|
-
|
|
20372
|
-
const
|
|
20373
|
-
const RED = create$4();
|
|
20374
|
-
const PURPLE = create$4();
|
|
20375
|
-
const ORANGE = create$4();
|
|
20376
|
-
const UNCOLOR = create$4();
|
|
20496
|
+
/**
|
|
20497
|
+
* @param {PRNG} gen
|
|
20498
|
+
* @return {string} A single letter (a-z)
|
|
20499
|
+
*/
|
|
20500
|
+
const letter = gen => fromCharCode(int31(gen, 97, 122));
|
|
20377
20501
|
|
|
20378
|
-
/* c8 ignore start */
|
|
20379
20502
|
/**
|
|
20380
|
-
* @param {
|
|
20381
|
-
* @
|
|
20503
|
+
* @param {PRNG} gen
|
|
20504
|
+
* @param {number} [minLen=0]
|
|
20505
|
+
* @param {number} [maxLen=20]
|
|
20506
|
+
* @return {string} A random word (0-20 characters) without spaces consisting of letters (a-z)
|
|
20382
20507
|
*/
|
|
20383
|
-
const
|
|
20384
|
-
|
|
20385
|
-
|
|
20386
|
-
|
|
20387
|
-
|
|
20388
|
-
const logArgs = [];
|
|
20389
|
-
// try with formatting until we find something unsupported
|
|
20390
|
-
let i = 0;
|
|
20391
|
-
for (; i < args.length; i++) {
|
|
20392
|
-
const arg = args[i];
|
|
20393
|
-
if (arg === undefined) {
|
|
20394
|
-
break
|
|
20395
|
-
} else if (arg.constructor === String || arg.constructor === Number) {
|
|
20396
|
-
strBuilder.push(arg);
|
|
20397
|
-
} else if (arg.constructor === Object) {
|
|
20398
|
-
break
|
|
20399
|
-
}
|
|
20400
|
-
}
|
|
20401
|
-
if (i > 0) {
|
|
20402
|
-
// create logArgs with what we have so far
|
|
20403
|
-
logArgs.push(strBuilder.join(''));
|
|
20404
|
-
}
|
|
20405
|
-
// append the rest
|
|
20406
|
-
for (; i < args.length; i++) {
|
|
20407
|
-
const arg = args[i];
|
|
20408
|
-
if (!(arg instanceof Symbol)) {
|
|
20409
|
-
logArgs.push(arg);
|
|
20410
|
-
}
|
|
20508
|
+
const word = (gen, minLen = 0, maxLen = 20) => {
|
|
20509
|
+
const len = int31(gen, minLen, maxLen);
|
|
20510
|
+
let str = '';
|
|
20511
|
+
for (let i = 0; i < len; i++) {
|
|
20512
|
+
str += letter(gen);
|
|
20411
20513
|
}
|
|
20412
|
-
return
|
|
20514
|
+
return str
|
|
20413
20515
|
};
|
|
20516
|
+
|
|
20517
|
+
/**
|
|
20518
|
+
* Returns one element of a given array.
|
|
20519
|
+
*
|
|
20520
|
+
* @param {PRNG} gen A random number generator.
|
|
20521
|
+
* @param {Array<T>} array Non empty Array of possible values.
|
|
20522
|
+
* @return {T} One of the values of the supplied Array.
|
|
20523
|
+
* @template T
|
|
20524
|
+
*/
|
|
20525
|
+
const oneOf = (gen, array) => array[int31(gen, 0, array.length - 1)];
|
|
20414
20526
|
/* c8 ignore stop */
|
|
20415
20527
|
|
|
20416
20528
|
/**
|
|
20417
|
-
*
|
|
20529
|
+
* @experimental WIP
|
|
20418
20530
|
*
|
|
20419
|
-
*
|
|
20531
|
+
* Simple & efficient schemas for your data.
|
|
20420
20532
|
*/
|
|
20421
20533
|
|
|
20422
20534
|
|
|
20423
20535
|
/**
|
|
20424
|
-
* @
|
|
20536
|
+
* @typedef {string|number|bigint|boolean|null|undefined|symbol} Primitive
|
|
20425
20537
|
*/
|
|
20426
|
-
const _browserStyleMap = {
|
|
20427
|
-
[BOLD]: create$5('font-weight', 'bold'),
|
|
20428
|
-
[UNBOLD]: create$5('font-weight', 'normal'),
|
|
20429
|
-
[BLUE]: create$5('color', 'blue'),
|
|
20430
|
-
[GREEN]: create$5('color', 'green'),
|
|
20431
|
-
[GREY]: create$5('color', 'grey'),
|
|
20432
|
-
[RED]: create$5('color', 'red'),
|
|
20433
|
-
[PURPLE]: create$5('color', 'purple'),
|
|
20434
|
-
[ORANGE]: create$5('color', 'orange'), // not well supported in chrome when debugging node with inspector - TODO: deprecate
|
|
20435
|
-
[UNCOLOR]: create$5('color', 'black')
|
|
20436
|
-
};
|
|
20437
20538
|
|
|
20438
20539
|
/**
|
|
20439
|
-
* @
|
|
20440
|
-
* @return {Array<string|object|number>}
|
|
20540
|
+
* @typedef {{ [k:string|number|symbol]: any }} AnyObject
|
|
20441
20541
|
*/
|
|
20442
|
-
/* c8 ignore start */
|
|
20443
|
-
const computeBrowserLoggingArgs = (args) => {
|
|
20444
|
-
if (args.length === 1 && args[0]?.constructor === Function) {
|
|
20445
|
-
args = /** @type {Array<string|Symbol|Object|number>} */ (/** @type {[function]} */ (args)[0]());
|
|
20446
|
-
}
|
|
20447
|
-
const strBuilder = [];
|
|
20448
|
-
const styles = [];
|
|
20449
|
-
const currentStyle = create$9();
|
|
20450
|
-
/**
|
|
20451
|
-
* @type {Array<string|Object|number>}
|
|
20452
|
-
*/
|
|
20453
|
-
let logArgs = [];
|
|
20454
|
-
// try with formatting until we find something unsupported
|
|
20455
|
-
let i = 0;
|
|
20456
|
-
for (; i < args.length; i++) {
|
|
20457
|
-
const arg = args[i];
|
|
20458
|
-
// @ts-ignore
|
|
20459
|
-
const style = _browserStyleMap[arg];
|
|
20460
|
-
if (style !== undefined) {
|
|
20461
|
-
currentStyle.set(style.left, style.right);
|
|
20462
|
-
} else {
|
|
20463
|
-
if (arg === undefined) {
|
|
20464
|
-
break
|
|
20465
|
-
}
|
|
20466
|
-
if (arg.constructor === String || arg.constructor === Number) {
|
|
20467
|
-
const style = mapToStyleString(currentStyle);
|
|
20468
|
-
if (i > 0 || style.length > 0) {
|
|
20469
|
-
strBuilder.push('%c' + arg);
|
|
20470
|
-
styles.push(style);
|
|
20471
|
-
} else {
|
|
20472
|
-
strBuilder.push(arg);
|
|
20473
|
-
}
|
|
20474
|
-
} else {
|
|
20475
|
-
break
|
|
20476
|
-
}
|
|
20477
|
-
}
|
|
20478
|
-
}
|
|
20479
|
-
if (i > 0) {
|
|
20480
|
-
// create logArgs with what we have so far
|
|
20481
|
-
logArgs = styles;
|
|
20482
|
-
logArgs.unshift(strBuilder.join(''));
|
|
20483
|
-
}
|
|
20484
|
-
// append the rest
|
|
20485
|
-
for (; i < args.length; i++) {
|
|
20486
|
-
const arg = args[i];
|
|
20487
|
-
if (!(arg instanceof Symbol)) {
|
|
20488
|
-
logArgs.push(arg);
|
|
20489
|
-
}
|
|
20490
|
-
}
|
|
20491
|
-
return logArgs
|
|
20492
|
-
};
|
|
20493
|
-
/* c8 ignore stop */
|
|
20494
|
-
|
|
20495
|
-
/* c8 ignore start */
|
|
20496
|
-
const computeLoggingArgs = supportsColor
|
|
20497
|
-
? computeBrowserLoggingArgs
|
|
20498
|
-
: computeNoColorLoggingArgs;
|
|
20499
|
-
/* c8 ignore stop */
|
|
20500
20542
|
|
|
20501
20543
|
/**
|
|
20502
|
-
* @
|
|
20544
|
+
* @template T
|
|
20545
|
+
* @typedef {T extends Schema<infer X> ? X : T} Unwrap
|
|
20503
20546
|
*/
|
|
20504
|
-
const print = (...args) => {
|
|
20505
|
-
console.log(...computeLoggingArgs(args));
|
|
20506
|
-
/* c8 ignore next */
|
|
20507
|
-
vconsoles.forEach((vc) => vc.print(args));
|
|
20508
|
-
};
|
|
20509
20547
|
|
|
20510
|
-
/* c8 ignore start */
|
|
20511
20548
|
/**
|
|
20512
|
-
* @
|
|
20549
|
+
* @template T
|
|
20550
|
+
* @typedef {T extends Schema<infer X> ? X : T} TypeOf
|
|
20513
20551
|
*/
|
|
20514
|
-
|
|
20515
|
-
|
|
20516
|
-
|
|
20517
|
-
|
|
20518
|
-
|
|
20519
|
-
|
|
20520
|
-
|
|
20552
|
+
|
|
20553
|
+
/**
|
|
20554
|
+
* @template {readonly unknown[]} T
|
|
20555
|
+
* @typedef {T extends readonly [Schema<infer First>, ...infer Rest] ? [First, ...UnwrapArray<Rest>] : [] } UnwrapArray
|
|
20556
|
+
*/
|
|
20557
|
+
|
|
20558
|
+
/**
|
|
20559
|
+
* @template T
|
|
20560
|
+
* @typedef {T extends Schema<infer S> ? Schema<S> : never} CastToSchema
|
|
20561
|
+
*/
|
|
20562
|
+
|
|
20563
|
+
/**
|
|
20564
|
+
* @template {unknown[]} Arr
|
|
20565
|
+
* @typedef {Arr extends [...unknown[], infer L] ? L : never} TupleLast
|
|
20566
|
+
*/
|
|
20567
|
+
|
|
20568
|
+
/**
|
|
20569
|
+
* @template {unknown[]} Arr
|
|
20570
|
+
* @typedef {Arr extends [...infer Fs, unknown] ? Fs : never} TuplePop
|
|
20571
|
+
*/
|
|
20572
|
+
|
|
20573
|
+
/**
|
|
20574
|
+
* @template {readonly unknown[]} T
|
|
20575
|
+
* @typedef {T extends []
|
|
20576
|
+
* ? {}
|
|
20577
|
+
* : T extends [infer First]
|
|
20578
|
+
* ? First
|
|
20579
|
+
* : T extends [infer First, ...infer Rest]
|
|
20580
|
+
* ? First & Intersect<Rest>
|
|
20581
|
+
* : never
|
|
20582
|
+
* } Intersect
|
|
20583
|
+
*/
|
|
20584
|
+
|
|
20585
|
+
const schemaSymbol = Symbol('0schema');
|
|
20586
|
+
|
|
20587
|
+
class ValidationError {
|
|
20588
|
+
constructor () {
|
|
20589
|
+
/**
|
|
20590
|
+
* Reverse errors
|
|
20591
|
+
* @type {Array<{ path: string?, expected: string, has: string, message: string? }>}
|
|
20592
|
+
*/
|
|
20593
|
+
this._rerrs = [];
|
|
20594
|
+
}
|
|
20595
|
+
|
|
20596
|
+
/**
|
|
20597
|
+
* @param {string?} path
|
|
20598
|
+
* @param {string} expected
|
|
20599
|
+
* @param {string} has
|
|
20600
|
+
* @param {string?} message
|
|
20601
|
+
*/
|
|
20602
|
+
extend (path, expected, has, message = null) {
|
|
20603
|
+
this._rerrs.push({ path, expected, has, message });
|
|
20604
|
+
}
|
|
20605
|
+
|
|
20606
|
+
toString () {
|
|
20607
|
+
const s = [];
|
|
20608
|
+
for (let i = this._rerrs.length - 1; i > 0; i--) {
|
|
20609
|
+
const r = this._rerrs[i];
|
|
20610
|
+
/* c8 ignore next */
|
|
20611
|
+
s.push(repeat(' ', (this._rerrs.length - i) * 2) + `${r.path != null ? `[${r.path}] ` : ''}${r.has} doesn't match ${r.expected}. ${r.message}`);
|
|
20612
|
+
}
|
|
20613
|
+
return s.join('\n')
|
|
20614
|
+
}
|
|
20615
|
+
}
|
|
20616
|
+
|
|
20617
|
+
/**
|
|
20618
|
+
* @param {any} a
|
|
20619
|
+
* @param {any} b
|
|
20620
|
+
* @return {boolean}
|
|
20621
|
+
*/
|
|
20622
|
+
const shapeExtends = (a, b) => {
|
|
20623
|
+
if (a === b) return true
|
|
20624
|
+
if (a == null || b == null || a.constructor !== b.constructor) return false
|
|
20625
|
+
if (a[EqualityTraitSymbol]) return equals(a, b) // last resort: check equality (do this before array and obj check which don't implement the equality trait)
|
|
20626
|
+
if (isArray(a)) {
|
|
20627
|
+
return every$1(a, aitem =>
|
|
20628
|
+
some(b, bitem => shapeExtends(aitem, bitem))
|
|
20629
|
+
)
|
|
20630
|
+
} else if (isObject(a)) {
|
|
20631
|
+
return every(a, (aitem, akey) =>
|
|
20632
|
+
shapeExtends(aitem, b[akey])
|
|
20633
|
+
)
|
|
20634
|
+
}
|
|
20635
|
+
/* c8 ignore next */
|
|
20636
|
+
return false
|
|
20637
|
+
};
|
|
20638
|
+
|
|
20639
|
+
/**
|
|
20640
|
+
* @template T
|
|
20641
|
+
* @implements {equalityTraits.EqualityTrait}
|
|
20642
|
+
*/
|
|
20643
|
+
class Schema {
|
|
20644
|
+
// this.shape must not be defined on Schema. Otherwise typecheck on metatypes (e.g. $$object) won't work as expected anymore
|
|
20645
|
+
/**
|
|
20646
|
+
* If true, the more things are added to the shape the more objects this schema will accept (e.g.
|
|
20647
|
+
* union). By default, the more objects are added, the the fewer objects this schema will accept.
|
|
20648
|
+
* @protected
|
|
20649
|
+
*/
|
|
20650
|
+
static _dilutes = false
|
|
20651
|
+
|
|
20652
|
+
/**
|
|
20653
|
+
* @param {Schema<any>} other
|
|
20654
|
+
*/
|
|
20655
|
+
extends (other) {
|
|
20656
|
+
let [a, b] = [/** @type {any} */(this).shape, /** @type {any} */ (other).shape];
|
|
20657
|
+
if (/** @type {typeof Schema<any>} */ (this.constructor)._dilutes) [b, a] = [a, b];
|
|
20658
|
+
return shapeExtends(a, b)
|
|
20659
|
+
}
|
|
20660
|
+
|
|
20661
|
+
/**
|
|
20662
|
+
* Overwrite this when necessary. By default, we only check the `shape` property which every shape
|
|
20663
|
+
* should have.
|
|
20664
|
+
* @param {Schema<any>} other
|
|
20665
|
+
*/
|
|
20666
|
+
equals (other) {
|
|
20667
|
+
// @ts-ignore
|
|
20668
|
+
return this.constructor === other.constructor && equalityDeep$1(this.shape, other.shape)
|
|
20669
|
+
}
|
|
20670
|
+
|
|
20671
|
+
[schemaSymbol] () { return true }
|
|
20672
|
+
|
|
20673
|
+
/**
|
|
20674
|
+
* @param {object} other
|
|
20675
|
+
*/
|
|
20676
|
+
[EqualityTraitSymbol] (other) {
|
|
20677
|
+
return this.equals(/** @type {any} */ (other))
|
|
20678
|
+
}
|
|
20679
|
+
|
|
20680
|
+
/**
|
|
20681
|
+
* Use `schema.validate(obj)` with a typed parameter that is already of typed to be an instance of
|
|
20682
|
+
* Schema. Validate will check the structure of the parameter and return true iff the instance
|
|
20683
|
+
* really is an instance of Schema.
|
|
20684
|
+
*
|
|
20685
|
+
* @param {T} o
|
|
20686
|
+
* @return {boolean}
|
|
20687
|
+
*/
|
|
20688
|
+
validate (o) {
|
|
20689
|
+
return this.check(o)
|
|
20690
|
+
}
|
|
20691
|
+
|
|
20692
|
+
/* c8 ignore start */
|
|
20693
|
+
/**
|
|
20694
|
+
* Similar to validate, but this method accepts untyped parameters.
|
|
20695
|
+
*
|
|
20696
|
+
* @param {any} _o
|
|
20697
|
+
* @param {ValidationError} [_err]
|
|
20698
|
+
* @return {_o is T}
|
|
20699
|
+
*/
|
|
20700
|
+
check (_o, _err) {
|
|
20701
|
+
methodUnimplemented();
|
|
20702
|
+
}
|
|
20703
|
+
/* c8 ignore stop */
|
|
20704
|
+
|
|
20705
|
+
/**
|
|
20706
|
+
* @type {Schema<T?>}
|
|
20707
|
+
*/
|
|
20708
|
+
get nullable () {
|
|
20709
|
+
// @ts-ignore
|
|
20710
|
+
return $union(this, $null)
|
|
20711
|
+
}
|
|
20712
|
+
|
|
20713
|
+
/**
|
|
20714
|
+
* @type {$Optional<Schema<T>>}
|
|
20715
|
+
*/
|
|
20716
|
+
get optional () {
|
|
20717
|
+
return new $Optional(/** @type {Schema<T>} */ (this))
|
|
20718
|
+
}
|
|
20719
|
+
|
|
20720
|
+
/**
|
|
20721
|
+
* Cast a variable to a specific type. Returns the casted value, or throws an exception otherwise.
|
|
20722
|
+
* Use this if you know that the type is of a specific type and you just want to convince the type
|
|
20723
|
+
* system.
|
|
20724
|
+
*
|
|
20725
|
+
* **Do not rely on these error messages!**
|
|
20726
|
+
* Performs an assertion check only if not in a production environment.
|
|
20727
|
+
*
|
|
20728
|
+
* @template OO
|
|
20729
|
+
* @param {OO} o
|
|
20730
|
+
* @return {Extract<OO, T> extends never ? T : (OO extends Array<never> ? T : Extract<OO,T>)}
|
|
20731
|
+
*/
|
|
20732
|
+
cast (o) {
|
|
20733
|
+
assert(o, this);
|
|
20734
|
+
return /** @type {any} */ (o)
|
|
20735
|
+
}
|
|
20736
|
+
|
|
20737
|
+
/**
|
|
20738
|
+
* EXPECTO PATRONUM!! 🪄
|
|
20739
|
+
* This function protects against type errors. Though it may not work in the real world.
|
|
20740
|
+
*
|
|
20741
|
+
* "After all this time?"
|
|
20742
|
+
* "Always." - Snape, talking about type safety
|
|
20743
|
+
*
|
|
20744
|
+
* Ensures that a variable is a a specific type. Returns the value, or throws an exception if the assertion check failed.
|
|
20745
|
+
* Use this if you know that the type is of a specific type and you just want to convince the type
|
|
20746
|
+
* system.
|
|
20747
|
+
*
|
|
20748
|
+
* Can be useful when defining lambdas: `s.lambda(s.$number, s.$void).expect((n) => n + 1)`
|
|
20749
|
+
*
|
|
20750
|
+
* **Do not rely on these error messages!**
|
|
20751
|
+
* Performs an assertion check if not in a production environment.
|
|
20752
|
+
*
|
|
20753
|
+
* @param {T} o
|
|
20754
|
+
* @return {o extends T ? T : never}
|
|
20755
|
+
*/
|
|
20756
|
+
expect (o) {
|
|
20757
|
+
assert(o, this);
|
|
20758
|
+
return o
|
|
20759
|
+
}
|
|
20760
|
+
}
|
|
20761
|
+
|
|
20762
|
+
/**
|
|
20763
|
+
* @template {(new (...args:any[]) => any) | ((...args:any[]) => any)} Constr
|
|
20764
|
+
* @typedef {Constr extends ((...args:any[]) => infer T) ? T : (Constr extends (new (...args:any[]) => any) ? InstanceType<Constr> : never)} Instance
|
|
20765
|
+
*/
|
|
20766
|
+
|
|
20767
|
+
/**
|
|
20768
|
+
* @template {(new (...args:any[]) => any) | ((...args:any[]) => any)} C
|
|
20769
|
+
* @extends {Schema<Instance<C>>}
|
|
20770
|
+
*/
|
|
20771
|
+
class $ConstructedBy extends Schema {
|
|
20772
|
+
/**
|
|
20773
|
+
* @param {C} c
|
|
20774
|
+
* @param {((o:Instance<C>)=>boolean)|null} check
|
|
20775
|
+
*/
|
|
20776
|
+
constructor (c, check) {
|
|
20777
|
+
super();
|
|
20778
|
+
this.shape = c;
|
|
20779
|
+
this._c = check;
|
|
20780
|
+
}
|
|
20781
|
+
|
|
20782
|
+
/**
|
|
20783
|
+
* @param {any} o
|
|
20784
|
+
* @param {ValidationError} [err]
|
|
20785
|
+
* @return {o is C extends ((...args:any[]) => infer T) ? T : (C extends (new (...args:any[]) => any) ? InstanceType<C> : never)} o
|
|
20786
|
+
*/
|
|
20787
|
+
check (o, err = undefined) {
|
|
20788
|
+
const c = o?.constructor === this.shape && (this._c == null || this._c(o));
|
|
20789
|
+
/* c8 ignore next */
|
|
20790
|
+
!c && err?.extend(null, this.shape.name, o?.constructor.name, o?.constructor !== this.shape ? 'Constructor match failed' : 'Check failed');
|
|
20791
|
+
return c
|
|
20792
|
+
}
|
|
20793
|
+
}
|
|
20794
|
+
|
|
20795
|
+
/**
|
|
20796
|
+
* @template {(new (...args:any[]) => any) | ((...args:any[]) => any)} C
|
|
20797
|
+
* @param {C} c
|
|
20798
|
+
* @param {((o:Instance<C>) => boolean)|null} check
|
|
20799
|
+
* @return {CastToSchema<$ConstructedBy<C>>}
|
|
20800
|
+
*/
|
|
20801
|
+
const $constructedBy = (c, check = null) => new $ConstructedBy(c, check);
|
|
20802
|
+
$constructedBy($ConstructedBy);
|
|
20803
|
+
|
|
20804
|
+
/**
|
|
20805
|
+
* Check custom properties on any object. You may want to overwrite the generated Schema<any>.
|
|
20806
|
+
*
|
|
20807
|
+
* @extends {Schema<any>}
|
|
20808
|
+
*/
|
|
20809
|
+
class $Custom extends Schema {
|
|
20810
|
+
/**
|
|
20811
|
+
* @param {(o:any) => boolean} check
|
|
20812
|
+
*/
|
|
20813
|
+
constructor (check) {
|
|
20814
|
+
super();
|
|
20815
|
+
/**
|
|
20816
|
+
* @type {(o:any) => boolean}
|
|
20817
|
+
*/
|
|
20818
|
+
this.shape = check;
|
|
20819
|
+
}
|
|
20820
|
+
|
|
20821
|
+
/**
|
|
20822
|
+
* @param {any} o
|
|
20823
|
+
* @param {ValidationError} err
|
|
20824
|
+
* @return {o is any}
|
|
20825
|
+
*/
|
|
20826
|
+
check (o, err) {
|
|
20827
|
+
const c = this.shape(o);
|
|
20828
|
+
/* c8 ignore next */
|
|
20829
|
+
!c && err?.extend(null, 'custom prop', o?.constructor.name, 'failed to check custom prop');
|
|
20830
|
+
return c
|
|
20831
|
+
}
|
|
20832
|
+
}
|
|
20833
|
+
|
|
20834
|
+
/**
|
|
20835
|
+
* @param {(o:any) => boolean} check
|
|
20836
|
+
* @return {Schema<any>}
|
|
20837
|
+
*/
|
|
20838
|
+
const $custom = (check) => new $Custom(check);
|
|
20839
|
+
$constructedBy($Custom);
|
|
20840
|
+
|
|
20841
|
+
/**
|
|
20842
|
+
* @template {Primitive} T
|
|
20843
|
+
* @extends {Schema<T>}
|
|
20844
|
+
*/
|
|
20845
|
+
class $Literal extends Schema {
|
|
20846
|
+
/**
|
|
20847
|
+
* @param {Array<T>} literals
|
|
20848
|
+
*/
|
|
20849
|
+
constructor (literals) {
|
|
20850
|
+
super();
|
|
20851
|
+
this.shape = literals;
|
|
20852
|
+
}
|
|
20853
|
+
|
|
20854
|
+
/**
|
|
20855
|
+
*
|
|
20856
|
+
* @param {any} o
|
|
20857
|
+
* @param {ValidationError} [err]
|
|
20858
|
+
* @return {o is T}
|
|
20859
|
+
*/
|
|
20860
|
+
check (o, err) {
|
|
20861
|
+
const c = this.shape.some(a => a === o);
|
|
20862
|
+
/* c8 ignore next */
|
|
20863
|
+
!c && err?.extend(null, this.shape.join(' | '), o.toString());
|
|
20864
|
+
return c
|
|
20865
|
+
}
|
|
20866
|
+
}
|
|
20867
|
+
|
|
20868
|
+
/**
|
|
20869
|
+
* @template {Primitive[]} T
|
|
20870
|
+
* @param {T} literals
|
|
20871
|
+
* @return {CastToSchema<$Literal<T[number]>>}
|
|
20872
|
+
*/
|
|
20873
|
+
const $literal = (...literals) => new $Literal(literals);
|
|
20874
|
+
const $$literal = $constructedBy($Literal);
|
|
20875
|
+
|
|
20876
|
+
/**
|
|
20877
|
+
* @template {Array<string|Schema<string|number>>} Ts
|
|
20878
|
+
* @typedef {Ts extends [] ? `` : (Ts extends [infer T] ? (Unwrap<T> extends (string|number) ? Unwrap<T> : never) : (Ts extends [infer T1, ...infer Rest] ? `${Unwrap<T1> extends (string|number) ? Unwrap<T1> : never}${Rest extends Array<string|Schema<string|number>> ? CastStringTemplateArgsToTemplate<Rest> : never}` : never))} CastStringTemplateArgsToTemplate
|
|
20879
|
+
*/
|
|
20880
|
+
|
|
20881
|
+
/**
|
|
20882
|
+
* @param {string} str
|
|
20883
|
+
* @return {string}
|
|
20884
|
+
*/
|
|
20885
|
+
const _regexEscape = /** @type {any} */ (RegExp).escape || /** @type {(str:string) => string} */ (str =>
|
|
20886
|
+
str.replace(/[().|&,$^[\]]/g, s => '\\' + s)
|
|
20887
|
+
);
|
|
20888
|
+
|
|
20889
|
+
/**
|
|
20890
|
+
* @param {string|Schema<any>} s
|
|
20891
|
+
* @return {string[]}
|
|
20892
|
+
*/
|
|
20893
|
+
const _schemaStringTemplateToRegex = s => {
|
|
20894
|
+
if ($string.check(s)) {
|
|
20895
|
+
return [_regexEscape(s)]
|
|
20896
|
+
}
|
|
20897
|
+
if ($$literal.check(s)) {
|
|
20898
|
+
return /** @type {Array<string|number>} */ (s.shape).map(v => v + '')
|
|
20899
|
+
}
|
|
20900
|
+
if ($$number.check(s)) {
|
|
20901
|
+
return ['[+-]?\\d+.?\\d*']
|
|
20902
|
+
}
|
|
20903
|
+
if ($$string.check(s)) {
|
|
20904
|
+
return ['.*']
|
|
20905
|
+
}
|
|
20906
|
+
if ($$union.check(s)) {
|
|
20907
|
+
return s.shape.map(_schemaStringTemplateToRegex).flat(1)
|
|
20908
|
+
}
|
|
20909
|
+
/* c8 ignore next 2 */
|
|
20910
|
+
// unexpected schema structure (only supports unions and string in literal types)
|
|
20911
|
+
unexpectedCase();
|
|
20912
|
+
};
|
|
20913
|
+
|
|
20914
|
+
/**
|
|
20915
|
+
* @template {Array<string|Schema<string|number>>} T
|
|
20916
|
+
* @extends {Schema<CastStringTemplateArgsToTemplate<T>>}
|
|
20917
|
+
*/
|
|
20918
|
+
class $StringTemplate extends Schema {
|
|
20919
|
+
/**
|
|
20920
|
+
* @param {T} shape
|
|
20921
|
+
*/
|
|
20922
|
+
constructor (shape) {
|
|
20923
|
+
super();
|
|
20924
|
+
this.shape = shape;
|
|
20925
|
+
this._r = new RegExp('^' + shape.map(_schemaStringTemplateToRegex).map(opts => `(${opts.join('|')})`).join('') + '$');
|
|
20926
|
+
}
|
|
20927
|
+
|
|
20928
|
+
/**
|
|
20929
|
+
* @param {any} o
|
|
20930
|
+
* @param {ValidationError} [err]
|
|
20931
|
+
* @return {o is CastStringTemplateArgsToTemplate<T>}
|
|
20932
|
+
*/
|
|
20933
|
+
check (o, err) {
|
|
20934
|
+
const c = this._r.exec(o) != null;
|
|
20935
|
+
/* c8 ignore next */
|
|
20936
|
+
!c && err?.extend(null, this._r.toString(), o.toString(), 'String doesn\'t match string template.');
|
|
20937
|
+
return c
|
|
20938
|
+
}
|
|
20939
|
+
}
|
|
20940
|
+
$constructedBy($StringTemplate);
|
|
20941
|
+
|
|
20942
|
+
const isOptionalSymbol = Symbol('optional');
|
|
20943
|
+
/**
|
|
20944
|
+
* @template {Schema<any>} S
|
|
20945
|
+
* @extends Schema<Unwrap<S>|undefined>
|
|
20946
|
+
*/
|
|
20947
|
+
class $Optional extends Schema {
|
|
20948
|
+
/**
|
|
20949
|
+
* @param {S} shape
|
|
20950
|
+
*/
|
|
20951
|
+
constructor (shape) {
|
|
20952
|
+
super();
|
|
20953
|
+
this.shape = shape;
|
|
20954
|
+
}
|
|
20955
|
+
|
|
20956
|
+
/**
|
|
20957
|
+
* @param {any} o
|
|
20958
|
+
* @param {ValidationError} [err]
|
|
20959
|
+
* @return {o is (Unwrap<S>|undefined)}
|
|
20960
|
+
*/
|
|
20961
|
+
check (o, err) {
|
|
20962
|
+
const c = o === undefined || this.shape.check(o);
|
|
20963
|
+
/* c8 ignore next */
|
|
20964
|
+
!c && err?.extend(null, 'undefined (optional)', '()');
|
|
20965
|
+
return c
|
|
20966
|
+
}
|
|
20967
|
+
|
|
20968
|
+
get [isOptionalSymbol] () { return true }
|
|
20969
|
+
}
|
|
20970
|
+
const $$optional = $constructedBy($Optional);
|
|
20971
|
+
|
|
20972
|
+
/**
|
|
20973
|
+
* @extends Schema<never>
|
|
20974
|
+
*/
|
|
20975
|
+
class $Never extends Schema {
|
|
20976
|
+
/**
|
|
20977
|
+
* @param {any} _o
|
|
20978
|
+
* @param {ValidationError} [err]
|
|
20979
|
+
* @return {_o is never}
|
|
20980
|
+
*/
|
|
20981
|
+
check (_o, err) {
|
|
20982
|
+
/* c8 ignore next */
|
|
20983
|
+
err?.extend(null, 'never', typeof _o);
|
|
20984
|
+
return false
|
|
20985
|
+
}
|
|
20986
|
+
}
|
|
20987
|
+
$constructedBy($Never);
|
|
20988
|
+
|
|
20989
|
+
/**
|
|
20990
|
+
* @template {{ [key: string|symbol|number]: Schema<any> }} S
|
|
20991
|
+
* @typedef {{ [Key in keyof S as S[Key] extends $Optional<Schema<any>> ? Key : never]?: S[Key] extends $Optional<Schema<infer Type>> ? Type : never } & { [Key in keyof S as S[Key] extends $Optional<Schema<any>> ? never : Key]: S[Key] extends Schema<infer Type> ? Type : never }} $ObjectToType
|
|
20992
|
+
*/
|
|
20993
|
+
|
|
20994
|
+
/**
|
|
20995
|
+
* @template {{[key:string|symbol|number]: Schema<any>}} S
|
|
20996
|
+
* @extends {Schema<$ObjectToType<S>>}
|
|
20997
|
+
*/
|
|
20998
|
+
class $Object extends Schema {
|
|
20999
|
+
/**
|
|
21000
|
+
* @param {S} shape
|
|
21001
|
+
* @param {boolean} partial
|
|
21002
|
+
*/
|
|
21003
|
+
constructor (shape, partial = false) {
|
|
21004
|
+
super();
|
|
21005
|
+
/**
|
|
21006
|
+
* @type {S}
|
|
21007
|
+
*/
|
|
21008
|
+
this.shape = shape;
|
|
21009
|
+
this._isPartial = partial;
|
|
21010
|
+
}
|
|
21011
|
+
|
|
21012
|
+
static _dilutes = true
|
|
21013
|
+
|
|
21014
|
+
/**
|
|
21015
|
+
* @type {Schema<Partial<$ObjectToType<S>>>}
|
|
21016
|
+
*/
|
|
21017
|
+
get partial () {
|
|
21018
|
+
return new $Object(this.shape, true)
|
|
21019
|
+
}
|
|
21020
|
+
|
|
21021
|
+
/**
|
|
21022
|
+
* @param {any} o
|
|
21023
|
+
* @param {ValidationError} err
|
|
21024
|
+
* @return {o is $ObjectToType<S>}
|
|
21025
|
+
*/
|
|
21026
|
+
check (o, err) {
|
|
21027
|
+
if (o == null) {
|
|
21028
|
+
/* c8 ignore next */
|
|
21029
|
+
err?.extend(null, 'object', 'null');
|
|
21030
|
+
return false
|
|
21031
|
+
}
|
|
21032
|
+
return every(this.shape, (vv, vk) => {
|
|
21033
|
+
const c = (this._isPartial && !hasProperty$1(o, vk)) || vv.check(o[vk], err);
|
|
21034
|
+
!c && err?.extend(vk.toString(), vv.toString(), typeof o[vk], 'Object property does not match');
|
|
21035
|
+
return c
|
|
21036
|
+
})
|
|
21037
|
+
}
|
|
21038
|
+
}
|
|
21039
|
+
|
|
21040
|
+
/**
|
|
21041
|
+
* @template S
|
|
21042
|
+
* @typedef {Schema<{ [Key in keyof S as S[Key] extends $Optional<Schema<any>> ? Key : never]?: S[Key] extends $Optional<Schema<infer Type>> ? Type : never } & { [Key in keyof S as S[Key] extends $Optional<Schema<any>> ? never : Key]: S[Key] extends Schema<infer Type> ? Type : never }>} _ObjectDefToSchema
|
|
21043
|
+
*/
|
|
21044
|
+
|
|
21045
|
+
// I used an explicit type annotation instead of $ObjectToType, so that the user doesn't see the
|
|
21046
|
+
// weird type definitions when inspecting type definions.
|
|
21047
|
+
/**
|
|
21048
|
+
* @template {{ [key:string|symbol|number]: Schema<any> }} S
|
|
21049
|
+
* @param {S} def
|
|
21050
|
+
* @return {_ObjectDefToSchema<S> extends Schema<infer S> ? Schema<{ [K in keyof S]: S[K] }> : never}
|
|
21051
|
+
*/
|
|
21052
|
+
const $object = def => /** @type {any} */ (new $Object(def));
|
|
21053
|
+
const $$object = $constructedBy($Object);
|
|
21054
|
+
/**
|
|
21055
|
+
* @type {Schema<{[key:string]: any}>}
|
|
21056
|
+
*/
|
|
21057
|
+
const $objectAny = $custom(o => o != null && (o.constructor === Object || o.constructor == null));
|
|
21058
|
+
|
|
21059
|
+
/**
|
|
21060
|
+
* @template {Schema<string|number|symbol>} Keys
|
|
21061
|
+
* @template {Schema<any>} Values
|
|
21062
|
+
* @extends {Schema<{ [key in Unwrap<Keys>]: Unwrap<Values> }>}
|
|
21063
|
+
*/
|
|
21064
|
+
class $Record extends Schema {
|
|
21065
|
+
/**
|
|
21066
|
+
* @param {Keys} keys
|
|
21067
|
+
* @param {Values} values
|
|
21068
|
+
*/
|
|
21069
|
+
constructor (keys, values) {
|
|
21070
|
+
super();
|
|
21071
|
+
this.shape = {
|
|
21072
|
+
keys, values
|
|
21073
|
+
};
|
|
21074
|
+
}
|
|
21075
|
+
|
|
21076
|
+
/**
|
|
21077
|
+
* @param {any} o
|
|
21078
|
+
* @param {ValidationError} err
|
|
21079
|
+
* @return {o is { [key in Unwrap<Keys>]: Unwrap<Values> }}
|
|
21080
|
+
*/
|
|
21081
|
+
check (o, err) {
|
|
21082
|
+
return o != null && every(o, (vv, vk) => {
|
|
21083
|
+
const ck = this.shape.keys.check(vk, err);
|
|
21084
|
+
/* c8 ignore next */
|
|
21085
|
+
!ck && err?.extend(vk + '', 'Record', typeof o, ck ? 'Key doesn\'t match schema' : 'Value doesn\'t match value');
|
|
21086
|
+
return ck && this.shape.values.check(vv, err)
|
|
21087
|
+
})
|
|
21088
|
+
}
|
|
21089
|
+
}
|
|
21090
|
+
|
|
21091
|
+
/**
|
|
21092
|
+
* @template {Schema<string|number|symbol>} Keys
|
|
21093
|
+
* @template {Schema<any>} Values
|
|
21094
|
+
* @param {Keys} keys
|
|
21095
|
+
* @param {Values} values
|
|
21096
|
+
* @return {CastToSchema<$Record<Keys,Values>>}
|
|
21097
|
+
*/
|
|
21098
|
+
const $record = (keys, values) => new $Record(keys, values);
|
|
21099
|
+
const $$record = $constructedBy($Record);
|
|
21100
|
+
|
|
21101
|
+
/**
|
|
21102
|
+
* @template {Schema<any>[]} S
|
|
21103
|
+
* @extends {Schema<{ [Key in keyof S]: S[Key] extends Schema<infer Type> ? Type : never }>}
|
|
21104
|
+
*/
|
|
21105
|
+
class $Tuple extends Schema {
|
|
21106
|
+
/**
|
|
21107
|
+
* @param {S} shape
|
|
21108
|
+
*/
|
|
21109
|
+
constructor (shape) {
|
|
21110
|
+
super();
|
|
21111
|
+
this.shape = shape;
|
|
21112
|
+
}
|
|
21113
|
+
|
|
21114
|
+
/**
|
|
21115
|
+
* @param {any} o
|
|
21116
|
+
* @param {ValidationError} err
|
|
21117
|
+
* @return {o is { [K in keyof S]: S[K] extends Schema<infer Type> ? Type : never }}
|
|
21118
|
+
*/
|
|
21119
|
+
check (o, err) {
|
|
21120
|
+
return o != null && every(this.shape, (vv, vk) => {
|
|
21121
|
+
const c = /** @type {Schema<any>} */ (vv).check(o[vk], err);
|
|
21122
|
+
/* c8 ignore next */
|
|
21123
|
+
!c && err?.extend(vk.toString(), 'Tuple', typeof vv);
|
|
21124
|
+
return c
|
|
21125
|
+
})
|
|
21126
|
+
}
|
|
21127
|
+
}
|
|
21128
|
+
|
|
21129
|
+
/**
|
|
21130
|
+
* @template {Array<Schema<any>>} T
|
|
21131
|
+
* @param {T} def
|
|
21132
|
+
* @return {CastToSchema<$Tuple<T>>}
|
|
21133
|
+
*/
|
|
21134
|
+
const $tuple = (...def) => new $Tuple(def);
|
|
21135
|
+
$constructedBy($Tuple);
|
|
21136
|
+
|
|
21137
|
+
/**
|
|
21138
|
+
* @template {Schema<any>} S
|
|
21139
|
+
* @extends {Schema<Array<S extends Schema<infer T> ? T : never>>}
|
|
21140
|
+
*/
|
|
21141
|
+
class $Array extends Schema {
|
|
21142
|
+
/**
|
|
21143
|
+
* @param {Array<S>} v
|
|
21144
|
+
*/
|
|
21145
|
+
constructor (v) {
|
|
21146
|
+
super();
|
|
21147
|
+
/**
|
|
21148
|
+
* @type {Schema<S extends Schema<infer T> ? T : never>}
|
|
21149
|
+
*/
|
|
21150
|
+
this.shape = v.length === 1 ? v[0] : new $Union(v);
|
|
21151
|
+
}
|
|
21152
|
+
|
|
21153
|
+
/**
|
|
21154
|
+
* @param {any} o
|
|
21155
|
+
* @param {ValidationError} [err]
|
|
21156
|
+
* @return {o is Array<S extends Schema<infer T> ? T : never>} o
|
|
21157
|
+
*/
|
|
21158
|
+
check (o, err) {
|
|
21159
|
+
const c = isArray(o) && every$1(o, oi => this.shape.check(oi));
|
|
21160
|
+
/* c8 ignore next */
|
|
21161
|
+
!c && err?.extend(null, 'Array', '');
|
|
21162
|
+
return c
|
|
21163
|
+
}
|
|
21164
|
+
}
|
|
21165
|
+
|
|
21166
|
+
/**
|
|
21167
|
+
* @template {Array<Schema<any>>} T
|
|
21168
|
+
* @param {T} def
|
|
21169
|
+
* @return {Schema<Array<T extends Array<Schema<infer S>> ? S : never>>}
|
|
21170
|
+
*/
|
|
21171
|
+
const $array = (...def) => new $Array(def);
|
|
21172
|
+
const $$array = $constructedBy($Array);
|
|
21173
|
+
/**
|
|
21174
|
+
* @type {Schema<Array<any>>}
|
|
21175
|
+
*/
|
|
21176
|
+
const $arrayAny = $custom(o => isArray(o));
|
|
21177
|
+
|
|
21178
|
+
/**
|
|
21179
|
+
* @template T
|
|
21180
|
+
* @extends {Schema<T>}
|
|
21181
|
+
*/
|
|
21182
|
+
class $InstanceOf extends Schema {
|
|
21183
|
+
/**
|
|
21184
|
+
* @param {new (...args:any) => T} constructor
|
|
21185
|
+
* @param {((o:T) => boolean)|null} check
|
|
21186
|
+
*/
|
|
21187
|
+
constructor (constructor, check) {
|
|
21188
|
+
super();
|
|
21189
|
+
this.shape = constructor;
|
|
21190
|
+
this._c = check;
|
|
21191
|
+
}
|
|
21192
|
+
|
|
21193
|
+
/**
|
|
21194
|
+
* @param {any} o
|
|
21195
|
+
* @param {ValidationError} err
|
|
21196
|
+
* @return {o is T}
|
|
21197
|
+
*/
|
|
21198
|
+
check (o, err) {
|
|
21199
|
+
const c = o instanceof this.shape && (this._c == null || this._c(o));
|
|
21200
|
+
/* c8 ignore next */
|
|
21201
|
+
!c && err?.extend(null, this.shape.name, o?.constructor.name);
|
|
21202
|
+
return c
|
|
21203
|
+
}
|
|
21204
|
+
}
|
|
21205
|
+
|
|
21206
|
+
/**
|
|
21207
|
+
* @template T
|
|
21208
|
+
* @param {new (...args:any) => T} c
|
|
21209
|
+
* @param {((o:T) => boolean)|null} check
|
|
21210
|
+
* @return {Schema<T>}
|
|
21211
|
+
*/
|
|
21212
|
+
const $instanceOf = (c, check = null) => new $InstanceOf(c, check);
|
|
21213
|
+
$constructedBy($InstanceOf);
|
|
21214
|
+
|
|
21215
|
+
const $$schema = $instanceOf(Schema);
|
|
21216
|
+
|
|
21217
|
+
/**
|
|
21218
|
+
* @template {Schema<any>[]} Args
|
|
21219
|
+
* @typedef {(...args:UnwrapArray<TuplePop<Args>>)=>Unwrap<TupleLast<Args>>} _LArgsToLambdaDef
|
|
21220
|
+
*/
|
|
21221
|
+
|
|
21222
|
+
/**
|
|
21223
|
+
* @template {Array<Schema<any>>} Args
|
|
21224
|
+
* @extends {Schema<_LArgsToLambdaDef<Args>>}
|
|
21225
|
+
*/
|
|
21226
|
+
class $Lambda extends Schema {
|
|
21227
|
+
/**
|
|
21228
|
+
* @param {Args} args
|
|
21229
|
+
*/
|
|
21230
|
+
constructor (args) {
|
|
21231
|
+
super();
|
|
21232
|
+
this.len = args.length - 1;
|
|
21233
|
+
this.args = $tuple(...args.slice(-1));
|
|
21234
|
+
this.res = args[this.len];
|
|
21235
|
+
}
|
|
21236
|
+
|
|
21237
|
+
/**
|
|
21238
|
+
* @param {any} f
|
|
21239
|
+
* @param {ValidationError} err
|
|
21240
|
+
* @return {f is _LArgsToLambdaDef<Args>}
|
|
21241
|
+
*/
|
|
21242
|
+
check (f, err) {
|
|
21243
|
+
const c = f.constructor === Function && f.length <= this.len;
|
|
21244
|
+
/* c8 ignore next */
|
|
21245
|
+
!c && err?.extend(null, 'function', typeof f);
|
|
21246
|
+
return c
|
|
21247
|
+
}
|
|
21248
|
+
}
|
|
21249
|
+
const $$lambda = $constructedBy($Lambda);
|
|
21250
|
+
|
|
21251
|
+
/**
|
|
21252
|
+
* @type {Schema<Function>}
|
|
21253
|
+
*/
|
|
21254
|
+
const $function = $custom(o => typeof o === 'function');
|
|
21255
|
+
|
|
21256
|
+
/**
|
|
21257
|
+
* @template {Array<Schema<any>>} T
|
|
21258
|
+
* @extends {Schema<Intersect<UnwrapArray<T>>>}
|
|
21259
|
+
*/
|
|
21260
|
+
class $Intersection extends Schema {
|
|
21261
|
+
/**
|
|
21262
|
+
* @param {T} v
|
|
21263
|
+
*/
|
|
21264
|
+
constructor (v) {
|
|
21265
|
+
super();
|
|
21266
|
+
/**
|
|
21267
|
+
* @type {T}
|
|
21268
|
+
*/
|
|
21269
|
+
this.shape = v;
|
|
21270
|
+
}
|
|
21271
|
+
|
|
21272
|
+
/**
|
|
21273
|
+
* @param {any} o
|
|
21274
|
+
* @param {ValidationError} [err]
|
|
21275
|
+
* @return {o is Intersect<UnwrapArray<T>>}
|
|
21276
|
+
*/
|
|
21277
|
+
check (o, err) {
|
|
21278
|
+
// @ts-ignore
|
|
21279
|
+
const c = every$1(this.shape, check => check.check(o, err));
|
|
21280
|
+
/* c8 ignore next */
|
|
21281
|
+
!c && err?.extend(null, 'Intersectinon', typeof o);
|
|
21282
|
+
return c
|
|
21283
|
+
}
|
|
21284
|
+
}
|
|
21285
|
+
$constructedBy($Intersection, o => o.shape.length > 0); // Intersection with length=0 is considered "any"
|
|
21286
|
+
|
|
21287
|
+
/**
|
|
21288
|
+
* @template S
|
|
21289
|
+
* @extends {Schema<S>}
|
|
21290
|
+
*/
|
|
21291
|
+
class $Union extends Schema {
|
|
21292
|
+
static _dilutes = true
|
|
21293
|
+
|
|
21294
|
+
/**
|
|
21295
|
+
* @param {Array<Schema<S>>} v
|
|
21296
|
+
*/
|
|
21297
|
+
constructor (v) {
|
|
21298
|
+
super();
|
|
21299
|
+
this.shape = v;
|
|
21300
|
+
}
|
|
21301
|
+
|
|
21302
|
+
/**
|
|
21303
|
+
* @param {any} o
|
|
21304
|
+
* @param {ValidationError} [err]
|
|
21305
|
+
* @return {o is S}
|
|
21306
|
+
*/
|
|
21307
|
+
check (o, err) {
|
|
21308
|
+
const c = some(this.shape, (vv) => vv.check(o, err));
|
|
21309
|
+
err?.extend(null, 'Union', typeof o);
|
|
21310
|
+
return c
|
|
21311
|
+
}
|
|
21312
|
+
}
|
|
21313
|
+
|
|
21314
|
+
/**
|
|
21315
|
+
* @template {Array<any>} T
|
|
21316
|
+
* @param {T} schemas
|
|
21317
|
+
* @return {CastToSchema<$Union<Unwrap<ReadSchema<T>>>>}
|
|
21318
|
+
*/
|
|
21319
|
+
const $union = (...schemas) => schemas.findIndex($s => $$union.check($s)) >= 0
|
|
21320
|
+
? $union(...schemas.map($s => $($s)).map($s => $$union.check($s) ? $s.shape : [$s]).flat(1))
|
|
21321
|
+
: (schemas.length === 1
|
|
21322
|
+
? schemas[0]
|
|
21323
|
+
: new $Union(schemas));
|
|
21324
|
+
const $$union = /** @type {Schema<$Union<any>>} */ ($constructedBy($Union));
|
|
21325
|
+
|
|
21326
|
+
const _t = () => true;
|
|
21327
|
+
/**
|
|
21328
|
+
* @type {Schema<any>}
|
|
21329
|
+
*/
|
|
21330
|
+
const $any = $custom(_t);
|
|
21331
|
+
const $$any = /** @type {Schema<Schema<any>>} */ ($constructedBy($Custom, o => o.shape === _t));
|
|
21332
|
+
|
|
21333
|
+
/**
|
|
21334
|
+
* @type {Schema<bigint>}
|
|
21335
|
+
*/
|
|
21336
|
+
const $bigint = $custom(o => typeof o === 'bigint');
|
|
21337
|
+
const $$bigint = /** @type {Schema<Schema<BigInt>>} */ ($custom(o => o === $bigint));
|
|
21338
|
+
|
|
21339
|
+
/**
|
|
21340
|
+
* @type {Schema<symbol>}
|
|
21341
|
+
*/
|
|
21342
|
+
const $symbol = $custom(o => typeof o === 'symbol');
|
|
21343
|
+
/** @type {Schema<Schema<Symbol>>} */ ($custom(o => o === $symbol));
|
|
21344
|
+
|
|
21345
|
+
/**
|
|
21346
|
+
* @type {Schema<number>}
|
|
21347
|
+
*/
|
|
21348
|
+
const $number = $custom(o => typeof o === 'number');
|
|
21349
|
+
const $$number = /** @type {Schema<Schema<number>>} */ ($custom(o => o === $number));
|
|
21350
|
+
|
|
21351
|
+
/**
|
|
21352
|
+
* @type {Schema<string>}
|
|
21353
|
+
*/
|
|
21354
|
+
const $string = $custom(o => typeof o === 'string');
|
|
21355
|
+
const $$string = /** @type {Schema<Schema<string>>} */ ($custom(o => o === $string));
|
|
21356
|
+
|
|
21357
|
+
/**
|
|
21358
|
+
* @type {Schema<boolean>}
|
|
21359
|
+
*/
|
|
21360
|
+
const $boolean = $custom(o => typeof o === 'boolean');
|
|
21361
|
+
const $$boolean = /** @type {Schema<Schema<Boolean>>} */ ($custom(o => o === $boolean));
|
|
21362
|
+
|
|
21363
|
+
/**
|
|
21364
|
+
* @type {Schema<undefined>}
|
|
21365
|
+
*/
|
|
21366
|
+
const $undefined = $literal(undefined);
|
|
21367
|
+
/** @type {Schema<Schema<undefined>>} */ ($constructedBy($Literal, o => o.shape.length === 1 && o.shape[0] === undefined));
|
|
21368
|
+
|
|
21369
|
+
/**
|
|
21370
|
+
* @type {Schema<void>}
|
|
21371
|
+
*/
|
|
21372
|
+
$literal(undefined);
|
|
21373
|
+
|
|
21374
|
+
const $null = $literal(null);
|
|
21375
|
+
const $$null = /** @type {Schema<Schema<null>>} */ ($constructedBy($Literal, o => o.shape.length === 1 && o.shape[0] === null));
|
|
21376
|
+
|
|
21377
|
+
$constructedBy(Uint8Array);
|
|
21378
|
+
/** @type {Schema<Schema<Uint8Array>>} */ ($constructedBy($ConstructedBy, o => o.shape === Uint8Array));
|
|
21379
|
+
|
|
21380
|
+
/**
|
|
21381
|
+
* @type {Schema<Primitive>}
|
|
21382
|
+
*/
|
|
21383
|
+
const $primitive = $union($number, $string, $null, $undefined, $bigint, $boolean, $symbol);
|
|
21384
|
+
|
|
21385
|
+
/**
|
|
21386
|
+
* @typedef {JSON[]} JSONArray
|
|
21387
|
+
*/
|
|
21388
|
+
/**
|
|
21389
|
+
* @typedef {Primitive|JSONArray|{ [key:string]:JSON }} JSON
|
|
21390
|
+
*/
|
|
21391
|
+
/**
|
|
21392
|
+
* @type {Schema<null|number|string|boolean|JSON[]|{[key:string]:JSON}>}
|
|
21393
|
+
*/
|
|
21394
|
+
(() => {
|
|
21395
|
+
const $jsonArr = /** @type {$Array<$any>} */ ($array($any));
|
|
21396
|
+
const $jsonRecord = /** @type {$Record<$string,$any>} */ ($record($string, $any));
|
|
21397
|
+
const $json = $union($number, $string, $null, $boolean, $jsonArr, $jsonRecord);
|
|
21398
|
+
$jsonArr.shape = $json;
|
|
21399
|
+
$jsonRecord.shape.values = $json;
|
|
21400
|
+
return $json
|
|
21401
|
+
})();
|
|
21402
|
+
|
|
21403
|
+
/**
|
|
21404
|
+
* @template {any} IN
|
|
21405
|
+
* @typedef {IN extends Schema<any> ? IN
|
|
21406
|
+
* : (IN extends string|number|boolean|null ? Schema<IN>
|
|
21407
|
+
* : (IN extends new (...args:any[])=>any ? Schema<InstanceType<IN>>
|
|
21408
|
+
* : (IN extends any[] ? Schema<{ [K in keyof IN]: Unwrap<ReadSchema<IN[K]>> }[number]>
|
|
21409
|
+
* : (IN extends object ? (_ObjectDefToSchema<{[K in keyof IN]:ReadSchema<IN[K]>}> extends Schema<infer S> ? Schema<{ [K in keyof S]: S[K] }> : never)
|
|
21410
|
+
* : never)
|
|
21411
|
+
* )
|
|
21412
|
+
* )
|
|
21413
|
+
* )
|
|
21414
|
+
* } ReadSchemaOld
|
|
21415
|
+
*/
|
|
21416
|
+
|
|
21417
|
+
/**
|
|
21418
|
+
* @template {any} IN
|
|
21419
|
+
* @typedef {[Extract<IN,Schema<any>>,Extract<IN,string|number|boolean|null>,Extract<IN,new (...args:any[])=>any>,Extract<IN,any[]>,Extract<Exclude<IN,Schema<any>|string|number|boolean|null|(new (...args:any[])=>any)|any[]>,object>] extends [infer Schemas, infer Primitives, infer Constructors, infer Arrs, infer Obj]
|
|
21420
|
+
* ? Schema<
|
|
21421
|
+
* (Schemas extends Schema<infer S> ? S : never)
|
|
21422
|
+
* | Primitives
|
|
21423
|
+
* | (Constructors extends new (...args:any[])=>any ? InstanceType<Constructors> : never)
|
|
21424
|
+
* | (Arrs extends any[] ? { [K in keyof Arrs]: Unwrap<ReadSchema<Arrs[K]>> }[number] : never)
|
|
21425
|
+
* | (Obj extends object ? Unwrap<(_ObjectDefToSchema<{[K in keyof Obj]:ReadSchema<Obj[K]>}> extends Schema<infer S> ? Schema<{ [K in keyof S]: S[K] }> : never)> : never)>
|
|
21426
|
+
* : never
|
|
21427
|
+
* } ReadSchema
|
|
21428
|
+
*/
|
|
21429
|
+
|
|
21430
|
+
/**
|
|
21431
|
+
* @typedef {ReadSchema<{x:42}|{y:99}|Schema<string>|[1,2,{}]>} Q
|
|
21432
|
+
*/
|
|
21433
|
+
|
|
21434
|
+
/**
|
|
21435
|
+
* @template IN
|
|
21436
|
+
* @param {IN} o
|
|
21437
|
+
* @return {ReadSchema<IN>}
|
|
21438
|
+
*/
|
|
21439
|
+
const $ = o => {
|
|
21440
|
+
if ($$schema.check(o)) {
|
|
21441
|
+
return /** @type {any} */ (o)
|
|
21442
|
+
} else if ($objectAny.check(o)) {
|
|
21443
|
+
/**
|
|
21444
|
+
* @type {any}
|
|
21445
|
+
*/
|
|
21446
|
+
const o2 = {};
|
|
21447
|
+
for (const k in o) {
|
|
21448
|
+
o2[k] = $(o[k]);
|
|
21449
|
+
}
|
|
21450
|
+
return /** @type {any} */ ($object(o2))
|
|
21451
|
+
} else if ($arrayAny.check(o)) {
|
|
21452
|
+
return /** @type {any} */ ($union(...o.map($)))
|
|
21453
|
+
} else if ($primitive.check(o)) {
|
|
21454
|
+
return /** @type {any} */ ($literal(o))
|
|
21455
|
+
} else if ($function.check(o)) {
|
|
21456
|
+
return /** @type {any} */ ($constructedBy(/** @type {any} */ (o)))
|
|
21457
|
+
}
|
|
21458
|
+
/* c8 ignore next */
|
|
21459
|
+
unexpectedCase();
|
|
21460
|
+
};
|
|
21461
|
+
|
|
21462
|
+
/* c8 ignore start */
|
|
21463
|
+
/**
|
|
21464
|
+
* Assert that a variable is of this specific type.
|
|
21465
|
+
* The assertion check is only performed in non-production environments.
|
|
21466
|
+
*
|
|
21467
|
+
* @type {<T>(o:any,schema:Schema<T>) => asserts o is T}
|
|
21468
|
+
*/
|
|
21469
|
+
const assert = production
|
|
21470
|
+
? () => {}
|
|
21471
|
+
: (o, schema) => {
|
|
21472
|
+
const err = new ValidationError();
|
|
21473
|
+
if (!schema.check(o, err)) {
|
|
21474
|
+
throw create$7(`Expected value to be of type ${schema.constructor.name}.\n${err.toString()}`)
|
|
21475
|
+
}
|
|
21476
|
+
};
|
|
21477
|
+
/* c8 ignore end */
|
|
21478
|
+
|
|
21479
|
+
/**
|
|
21480
|
+
* @template In
|
|
21481
|
+
* @template Out
|
|
21482
|
+
* @typedef {{ if: Schema<In>, h: (o:In,state?:any)=>Out }} Pattern
|
|
21483
|
+
*/
|
|
21484
|
+
|
|
21485
|
+
/**
|
|
21486
|
+
* @template {Pattern<any,any>} P
|
|
21487
|
+
* @template In
|
|
21488
|
+
* @typedef {ReturnType<Extract<P,Pattern<In extends number ? number : (In extends string ? string : In),any>>['h']>} PatternMatchResult
|
|
21489
|
+
*/
|
|
21490
|
+
|
|
21491
|
+
/**
|
|
21492
|
+
* @todo move this to separate library
|
|
21493
|
+
* @template {any} [State=undefined]
|
|
21494
|
+
* @template {Pattern<any,any>} [Patterns=never]
|
|
21495
|
+
*/
|
|
21496
|
+
class PatternMatcher {
|
|
21497
|
+
/**
|
|
21498
|
+
* @param {Schema<State>} [$state]
|
|
21499
|
+
*/
|
|
21500
|
+
constructor ($state) {
|
|
21501
|
+
/**
|
|
21502
|
+
* @type {Array<Patterns>}
|
|
21503
|
+
*/
|
|
21504
|
+
this.patterns = [];
|
|
21505
|
+
this.$state = $state;
|
|
21506
|
+
}
|
|
21507
|
+
|
|
21508
|
+
/**
|
|
21509
|
+
* @template P
|
|
21510
|
+
* @template R
|
|
21511
|
+
* @param {P} pattern
|
|
21512
|
+
* @param {(o:NoInfer<Unwrap<ReadSchema<P>>>,s:State)=>R} handler
|
|
21513
|
+
* @return {PatternMatcher<State,Patterns|Pattern<Unwrap<ReadSchema<P>>,R>>}
|
|
21514
|
+
*/
|
|
21515
|
+
if (pattern, handler) {
|
|
21516
|
+
// @ts-ignore
|
|
21517
|
+
this.patterns.push({ if: $(pattern), h: handler });
|
|
21518
|
+
// @ts-ignore
|
|
21519
|
+
return this
|
|
21520
|
+
}
|
|
21521
|
+
|
|
21522
|
+
/**
|
|
21523
|
+
* @template R
|
|
21524
|
+
* @param {(o:any,s:State)=>R} h
|
|
21525
|
+
*/
|
|
21526
|
+
else (h) {
|
|
21527
|
+
return this.if($any, h)
|
|
21528
|
+
}
|
|
21529
|
+
|
|
21530
|
+
/**
|
|
21531
|
+
* @return {State extends undefined
|
|
21532
|
+
* ? <In extends Unwrap<Patterns['if']>>(o:In,state?:undefined)=>PatternMatchResult<Patterns,In>
|
|
21533
|
+
* : <In extends Unwrap<Patterns['if']>>(o:In,state:State)=>PatternMatchResult<Patterns,In>}
|
|
21534
|
+
*/
|
|
21535
|
+
done () {
|
|
21536
|
+
// @ts-ignore
|
|
21537
|
+
return /** @type {any} */ (o, s) => {
|
|
21538
|
+
for (let i = 0; i < this.patterns.length; i++) {
|
|
21539
|
+
const p = this.patterns[i];
|
|
21540
|
+
if (p.if.check(o)) {
|
|
21541
|
+
// @ts-ignore
|
|
21542
|
+
return p.h(o, s)
|
|
21543
|
+
}
|
|
21544
|
+
}
|
|
21545
|
+
throw create$7('Unhandled pattern')
|
|
21546
|
+
}
|
|
21547
|
+
}
|
|
21548
|
+
}
|
|
21549
|
+
|
|
21550
|
+
/**
|
|
21551
|
+
* @template [State=undefined]
|
|
21552
|
+
* @param {State} [state]
|
|
21553
|
+
* @return {PatternMatcher<State extends undefined ? undefined : Unwrap<ReadSchema<State>>>}
|
|
21554
|
+
*/
|
|
21555
|
+
const match = state => new PatternMatcher(/** @type {any} */ (state));
|
|
21556
|
+
|
|
21557
|
+
/**
|
|
21558
|
+
* Helper function to generate a (non-exhaustive) sample set from a gives schema.
|
|
21559
|
+
*
|
|
21560
|
+
* @type {<T>(o:T,gen:prng.PRNG)=>T}
|
|
21561
|
+
*/
|
|
21562
|
+
const _random = /** @type {any} */ (match(/** @type {Schema<prng.PRNG>} */ ($any))
|
|
21563
|
+
.if($$number, (_o, gen) => int53(gen, MIN_SAFE_INTEGER, MAX_SAFE_INTEGER$2))
|
|
21564
|
+
.if($$string, (_o, gen) => word(gen))
|
|
21565
|
+
.if($$boolean, (_o, gen) => bool(gen))
|
|
21566
|
+
.if($$bigint, (_o, gen) => BigInt(int53(gen, MIN_SAFE_INTEGER, MAX_SAFE_INTEGER$2)))
|
|
21567
|
+
.if($$union, (o, gen) => random(gen, oneOf(gen, o.shape)))
|
|
21568
|
+
.if($$object, (o, gen) => {
|
|
21569
|
+
/**
|
|
21570
|
+
* @type {any}
|
|
21571
|
+
*/
|
|
21572
|
+
const res = {};
|
|
21573
|
+
for (const k in o.shape) {
|
|
21574
|
+
let prop = o.shape[k];
|
|
21575
|
+
if ($$optional.check(prop)) {
|
|
21576
|
+
if (bool(gen)) { continue }
|
|
21577
|
+
prop = prop.shape;
|
|
21578
|
+
}
|
|
21579
|
+
res[k] = _random(prop, gen);
|
|
21580
|
+
}
|
|
21581
|
+
return res
|
|
21582
|
+
})
|
|
21583
|
+
.if($$array, (o, gen) => {
|
|
21584
|
+
const arr = [];
|
|
21585
|
+
const n = int32(gen, 0, 42);
|
|
21586
|
+
for (let i = 0; i < n; i++) {
|
|
21587
|
+
arr.push(random(gen, o.shape));
|
|
21588
|
+
}
|
|
21589
|
+
return arr
|
|
21590
|
+
})
|
|
21591
|
+
.if($$literal, (o, gen) => {
|
|
21592
|
+
return oneOf(gen, o.shape)
|
|
21593
|
+
})
|
|
21594
|
+
.if($$null, (o, gen) => {
|
|
21595
|
+
return null
|
|
21596
|
+
})
|
|
21597
|
+
.if($$lambda, (o, gen) => {
|
|
21598
|
+
const res = random(gen, o.res);
|
|
21599
|
+
return () => res
|
|
21600
|
+
})
|
|
21601
|
+
.if($$any, (o, gen) => random(gen, oneOf(gen, [
|
|
21602
|
+
$number, $string, $null, $undefined, $bigint, $boolean,
|
|
21603
|
+
$array($number),
|
|
21604
|
+
$record($union('a', 'b', 'c'), $number)
|
|
21605
|
+
])))
|
|
21606
|
+
.if($$record, (o, gen) => {
|
|
21607
|
+
/**
|
|
21608
|
+
* @type {any}
|
|
21609
|
+
*/
|
|
21610
|
+
const res = {};
|
|
21611
|
+
const keysN = int53(gen, 0, 3);
|
|
21612
|
+
for (let i = 0; i < keysN; i++) {
|
|
21613
|
+
const key = random(gen, o.shape.keys);
|
|
21614
|
+
const val = random(gen, o.shape.values);
|
|
21615
|
+
res[key] = val;
|
|
21616
|
+
}
|
|
21617
|
+
return res
|
|
21618
|
+
})
|
|
21619
|
+
.done());
|
|
21620
|
+
|
|
21621
|
+
/**
|
|
21622
|
+
* @template S
|
|
21623
|
+
* @param {prng.PRNG} gen
|
|
21624
|
+
* @param {S} schema
|
|
21625
|
+
* @return {Unwrap<ReadSchema<S>>}
|
|
21626
|
+
*/
|
|
21627
|
+
const random = (gen, schema) => /** @type {any} */ (_random($(schema), gen));
|
|
21628
|
+
|
|
21629
|
+
/* eslint-env browser */
|
|
21630
|
+
|
|
21631
|
+
|
|
21632
|
+
/* c8 ignore start */
|
|
21633
|
+
/**
|
|
21634
|
+
* @type {Document}
|
|
21635
|
+
*/
|
|
21636
|
+
const doc = /** @type {Document} */ (typeof document !== 'undefined' ? document : {});
|
|
21637
|
+
|
|
21638
|
+
/**
|
|
21639
|
+
* @type {$.Schema<DocumentFragment>}
|
|
21640
|
+
*/
|
|
21641
|
+
$custom(el => el.nodeType === DOCUMENT_FRAGMENT_NODE);
|
|
21642
|
+
|
|
21643
|
+
/** @type {DOMParser} */ (typeof DOMParser !== 'undefined' ? new DOMParser() : null);
|
|
21644
|
+
|
|
21645
|
+
/**
|
|
21646
|
+
* @type {$.Schema<Element>}
|
|
21647
|
+
*/
|
|
21648
|
+
$custom(el => el.nodeType === ELEMENT_NODE);
|
|
21649
|
+
|
|
21650
|
+
/**
|
|
21651
|
+
* @type {$.Schema<Text>}
|
|
21652
|
+
*/
|
|
21653
|
+
$custom(el => el.nodeType === TEXT_NODE);
|
|
21654
|
+
|
|
21655
|
+
/**
|
|
21656
|
+
* @param {Map<string,string>} m
|
|
21657
|
+
* @return {string}
|
|
21658
|
+
*/
|
|
21659
|
+
const mapToStyleString = m => map$1(m, (value, key) => `${key}:${value};`).join('');
|
|
21660
|
+
|
|
21661
|
+
const ELEMENT_NODE = doc.ELEMENT_NODE;
|
|
21662
|
+
const TEXT_NODE = doc.TEXT_NODE;
|
|
21663
|
+
const DOCUMENT_NODE = doc.DOCUMENT_NODE;
|
|
21664
|
+
const DOCUMENT_FRAGMENT_NODE = doc.DOCUMENT_FRAGMENT_NODE;
|
|
21665
|
+
|
|
21666
|
+
/**
|
|
21667
|
+
* @type {$.Schema<Node>}
|
|
21668
|
+
*/
|
|
21669
|
+
$custom(el => el.nodeType === DOCUMENT_NODE);
|
|
21670
|
+
/* c8 ignore stop */
|
|
21671
|
+
|
|
21672
|
+
/**
|
|
21673
|
+
* Utility module to work with EcmaScript Symbols.
|
|
21674
|
+
*
|
|
21675
|
+
* @module symbol
|
|
21676
|
+
*/
|
|
21677
|
+
|
|
21678
|
+
/**
|
|
21679
|
+
* Return fresh symbol.
|
|
21680
|
+
*/
|
|
21681
|
+
const create$4 = Symbol;
|
|
21682
|
+
|
|
21683
|
+
const BOLD = create$4();
|
|
21684
|
+
const UNBOLD = create$4();
|
|
21685
|
+
const BLUE = create$4();
|
|
21686
|
+
const GREY = create$4();
|
|
21687
|
+
const GREEN = create$4();
|
|
21688
|
+
const RED = create$4();
|
|
21689
|
+
const PURPLE = create$4();
|
|
21690
|
+
const ORANGE = create$4();
|
|
21691
|
+
const UNCOLOR = create$4();
|
|
21692
|
+
|
|
21693
|
+
/* c8 ignore start */
|
|
21694
|
+
/**
|
|
21695
|
+
* @param {Array<undefined|string|Symbol|Object|number|function():any>} args
|
|
21696
|
+
* @return {Array<string|object|number|undefined>}
|
|
21697
|
+
*/
|
|
21698
|
+
const computeNoColorLoggingArgs = args => {
|
|
21699
|
+
if (args.length === 1 && args[0]?.constructor === Function) {
|
|
21700
|
+
args = /** @type {Array<string|Symbol|Object|number>} */ (/** @type {[function]} */ (args)[0]());
|
|
21701
|
+
}
|
|
21702
|
+
const strBuilder = [];
|
|
21703
|
+
const logArgs = [];
|
|
21704
|
+
// try with formatting until we find something unsupported
|
|
21705
|
+
let i = 0;
|
|
21706
|
+
for (; i < args.length; i++) {
|
|
21707
|
+
const arg = args[i];
|
|
21708
|
+
if (arg === undefined) {
|
|
21709
|
+
break
|
|
21710
|
+
} else if (arg.constructor === String || arg.constructor === Number) {
|
|
21711
|
+
strBuilder.push(arg);
|
|
21712
|
+
} else if (arg.constructor === Object) {
|
|
21713
|
+
break
|
|
21714
|
+
}
|
|
21715
|
+
}
|
|
21716
|
+
if (i > 0) {
|
|
21717
|
+
// create logArgs with what we have so far
|
|
21718
|
+
logArgs.push(strBuilder.join(''));
|
|
21719
|
+
}
|
|
21720
|
+
// append the rest
|
|
21721
|
+
for (; i < args.length; i++) {
|
|
21722
|
+
const arg = args[i];
|
|
21723
|
+
if (!(arg instanceof Symbol)) {
|
|
21724
|
+
logArgs.push(arg);
|
|
21725
|
+
}
|
|
21726
|
+
}
|
|
21727
|
+
return logArgs
|
|
21728
|
+
};
|
|
21729
|
+
/* c8 ignore stop */
|
|
21730
|
+
|
|
21731
|
+
/**
|
|
21732
|
+
* Isomorphic logging module with support for colors!
|
|
21733
|
+
*
|
|
21734
|
+
* @module logging
|
|
21735
|
+
*/
|
|
21736
|
+
|
|
21737
|
+
|
|
21738
|
+
/**
|
|
21739
|
+
* @type {Object<Symbol,pair.Pair<string,string>>}
|
|
21740
|
+
*/
|
|
21741
|
+
const _browserStyleMap = {
|
|
21742
|
+
[BOLD]: create$5('font-weight', 'bold'),
|
|
21743
|
+
[UNBOLD]: create$5('font-weight', 'normal'),
|
|
21744
|
+
[BLUE]: create$5('color', 'blue'),
|
|
21745
|
+
[GREEN]: create$5('color', 'green'),
|
|
21746
|
+
[GREY]: create$5('color', 'grey'),
|
|
21747
|
+
[RED]: create$5('color', 'red'),
|
|
21748
|
+
[PURPLE]: create$5('color', 'purple'),
|
|
21749
|
+
[ORANGE]: create$5('color', 'orange'), // not well supported in chrome when debugging node with inspector - TODO: deprecate
|
|
21750
|
+
[UNCOLOR]: create$5('color', 'black')
|
|
21751
|
+
};
|
|
21752
|
+
|
|
21753
|
+
/**
|
|
21754
|
+
* @param {Array<string|Symbol|Object|number|function():any>} args
|
|
21755
|
+
* @return {Array<string|object|number>}
|
|
21756
|
+
*/
|
|
21757
|
+
/* c8 ignore start */
|
|
21758
|
+
const computeBrowserLoggingArgs = (args) => {
|
|
21759
|
+
if (args.length === 1 && args[0]?.constructor === Function) {
|
|
21760
|
+
args = /** @type {Array<string|Symbol|Object|number>} */ (/** @type {[function]} */ (args)[0]());
|
|
21761
|
+
}
|
|
21762
|
+
const strBuilder = [];
|
|
21763
|
+
const styles = [];
|
|
21764
|
+
const currentStyle = create$9();
|
|
21765
|
+
/**
|
|
21766
|
+
* @type {Array<string|Object|number>}
|
|
21767
|
+
*/
|
|
21768
|
+
let logArgs = [];
|
|
21769
|
+
// try with formatting until we find something unsupported
|
|
21770
|
+
let i = 0;
|
|
21771
|
+
for (; i < args.length; i++) {
|
|
21772
|
+
const arg = args[i];
|
|
21773
|
+
// @ts-ignore
|
|
21774
|
+
const style = _browserStyleMap[arg];
|
|
21775
|
+
if (style !== undefined) {
|
|
21776
|
+
currentStyle.set(style.left, style.right);
|
|
21777
|
+
} else {
|
|
21778
|
+
if (arg === undefined) {
|
|
21779
|
+
break
|
|
21780
|
+
}
|
|
21781
|
+
if (arg.constructor === String || arg.constructor === Number) {
|
|
21782
|
+
const style = mapToStyleString(currentStyle);
|
|
21783
|
+
if (i > 0 || style.length > 0) {
|
|
21784
|
+
strBuilder.push('%c' + arg);
|
|
21785
|
+
styles.push(style);
|
|
21786
|
+
} else {
|
|
21787
|
+
strBuilder.push(arg);
|
|
21788
|
+
}
|
|
21789
|
+
} else {
|
|
21790
|
+
break
|
|
21791
|
+
}
|
|
21792
|
+
}
|
|
21793
|
+
}
|
|
21794
|
+
if (i > 0) {
|
|
21795
|
+
// create logArgs with what we have so far
|
|
21796
|
+
logArgs = styles;
|
|
21797
|
+
logArgs.unshift(strBuilder.join(''));
|
|
21798
|
+
}
|
|
21799
|
+
// append the rest
|
|
21800
|
+
for (; i < args.length; i++) {
|
|
21801
|
+
const arg = args[i];
|
|
21802
|
+
if (!(arg instanceof Symbol)) {
|
|
21803
|
+
logArgs.push(arg);
|
|
21804
|
+
}
|
|
21805
|
+
}
|
|
21806
|
+
return logArgs
|
|
21807
|
+
};
|
|
21808
|
+
/* c8 ignore stop */
|
|
21809
|
+
|
|
21810
|
+
/* c8 ignore start */
|
|
21811
|
+
const computeLoggingArgs = supportsColor
|
|
21812
|
+
? computeBrowserLoggingArgs
|
|
21813
|
+
: computeNoColorLoggingArgs;
|
|
21814
|
+
/* c8 ignore stop */
|
|
21815
|
+
|
|
21816
|
+
/**
|
|
21817
|
+
* @param {Array<string|Symbol|Object|number>} args
|
|
21818
|
+
*/
|
|
21819
|
+
const print = (...args) => {
|
|
21820
|
+
console.log(...computeLoggingArgs(args));
|
|
21821
|
+
/* c8 ignore next */
|
|
21822
|
+
vconsoles.forEach((vc) => vc.print(args));
|
|
21823
|
+
};
|
|
21824
|
+
|
|
21825
|
+
/* c8 ignore start */
|
|
21826
|
+
/**
|
|
21827
|
+
* @param {Array<string|Symbol|Object|number>} args
|
|
21828
|
+
*/
|
|
21829
|
+
const warn = (...args) => {
|
|
21830
|
+
console.warn(...computeLoggingArgs(args));
|
|
21831
|
+
args.unshift(ORANGE);
|
|
21832
|
+
vconsoles.forEach((vc) => vc.print(args));
|
|
21833
|
+
};
|
|
21834
|
+
|
|
21835
|
+
const vconsoles = create$8();
|
|
20521
21836
|
|
|
20522
21837
|
/**
|
|
20523
21838
|
* Utility module to create and manipulate Iterators.
|
|
@@ -24037,7 +25352,7 @@ class YEvent {
|
|
|
24037
25352
|
*/
|
|
24038
25353
|
this._changes = null;
|
|
24039
25354
|
/**
|
|
24040
|
-
* @type {null | Map<string, { action: 'add' | 'update' | 'delete', oldValue: any
|
|
25355
|
+
* @type {null | Map<string, { action: 'add' | 'update' | 'delete', oldValue: any }>}
|
|
24041
25356
|
*/
|
|
24042
25357
|
this._keys = null;
|
|
24043
25358
|
/**
|
|
@@ -24080,7 +25395,7 @@ class YEvent {
|
|
|
24080
25395
|
}
|
|
24081
25396
|
|
|
24082
25397
|
/**
|
|
24083
|
-
* @type {Map<string, { action: 'add' | 'update' | 'delete', oldValue: any
|
|
25398
|
+
* @type {Map<string, { action: 'add' | 'update' | 'delete', oldValue: any }>}
|
|
24084
25399
|
*/
|
|
24085
25400
|
get keys () {
|
|
24086
25401
|
if (this._keys === null) {
|
|
@@ -27455,12 +28770,10 @@ class YXmlElement extends YXmlFragment {
|
|
|
27455
28770
|
const el = new YXmlElement(this.nodeName);
|
|
27456
28771
|
const attrs = this.getAttributes();
|
|
27457
28772
|
forEach(attrs, (value, key) => {
|
|
27458
|
-
|
|
27459
|
-
el.setAttribute(key, value);
|
|
27460
|
-
}
|
|
28773
|
+
el.setAttribute(key, /** @type {any} */ (value));
|
|
27461
28774
|
});
|
|
27462
28775
|
// @ts-ignore
|
|
27463
|
-
el.insert(0, this.toArray().map(
|
|
28776
|
+
el.insert(0, this.toArray().map(v => v instanceof AbstractType ? v.clone() : v));
|
|
27464
28777
|
return el
|
|
27465
28778
|
}
|
|
27466
28779
|
|
|
@@ -34365,7 +35678,4 @@ const DEFAULT_LINE_TOOL_CONFIG = {
|
|
|
34365
35678
|
},
|
|
34366
35679
|
};
|
|
34367
35680
|
|
|
34368
|
-
export { KritzelBaseObject as $, isNode as A, min$2 as B, pow as C, HocuspocusProviderWebsocket as D, KritzelPath as E, KritzelImage as F, KritzelLine as G, HocuspocusProvider as H, KritzelGroup as I, KritzelBrushTool as J, KritzelText as K, KritzelLineTool as L, KritzelEraserTool as M, KritzelImageTool as N, Observable$1 as O, KritzelTextTool as P, KritzelCursorHelper as Q, KritzelSelectionTool as R, IndexedDBSyncProvider as S, KritzelAppStateMap as T, KritzelWorkspace as U, KritzelAnchorManager as V, DEFAULT_BRUSH_CONFIG as W, DEFAULT_TEXT_CONFIG as X, DEFAULT_LINE_TOOL_CONFIG as Y, KritzelDevicesHelper as Z, KritzelMouseButton as _, writeVarUint8Array$2 as a, Schema as a0, schema as a1, addListNodes as a2, EditorView as a3, EditorState as a4, keymap as a5, TextSelection as a6, KritzelKeyboardHelper as a7, KritzelToolRegistry as a8, KritzelGeometryHelper as a9, baseKeymap as aa, KritzelBaseTool as ab, KritzelEventHelper as ac, KritzelIconRegistry as ad, KritzelBaseHandler as ae, KritzelSelectionBox as af, KritzelSelectionGroup as ag, Doc as ah, DEFAULT_SYNC_CONFIG as ai, UndoManager as aj, ObjectHelper as ak, KritzelClassHelper as al, readVarUint8Array$2 as b, applyUpdate as c, encodeStateVector as d, encodeStateAsUpdate as e, createEncoder$1 as f, createDecoder$1 as g, create$8 as h, fromBase64 as i, toBase64 as j, createUint8ArrayFromArrayBuffer as k, offChange as l, readVarString$2 as m, floor$2 as n, onChange as o, getUnixTime$1 as p, equalityDeep$1 as q, readVarUint$2 as r, setIfUndefined$1 as s, toUint8Array$1 as t, writeVarString$2 as u, varStorage as v, writeVarUint$2 as w, map as x, ObservableV2 as y, length$
|
|
34369
|
-
//# sourceMappingURL=default-line-tool.config-CuBm2vpW.js.map
|
|
34370
|
-
|
|
34371
|
-
//# sourceMappingURL=default-line-tool.config-CuBm2vpW.js.map
|
|
35681
|
+
export { KritzelBaseObject as $, isNode as A, min$2 as B, pow as C, HocuspocusProviderWebsocket as D, KritzelPath as E, KritzelImage as F, KritzelLine as G, HocuspocusProvider as H, KritzelGroup as I, KritzelBrushTool as J, KritzelText as K, KritzelLineTool as L, KritzelEraserTool as M, KritzelImageTool as N, Observable$1 as O, KritzelTextTool as P, KritzelCursorHelper as Q, KritzelSelectionTool as R, IndexedDBSyncProvider as S, KritzelAppStateMap as T, KritzelWorkspace as U, KritzelAnchorManager as V, DEFAULT_BRUSH_CONFIG as W, DEFAULT_TEXT_CONFIG as X, DEFAULT_LINE_TOOL_CONFIG as Y, KritzelDevicesHelper as Z, KritzelMouseButton as _, writeVarUint8Array$2 as a, Schema$1 as a0, schema as a1, addListNodes as a2, EditorView as a3, EditorState as a4, keymap as a5, TextSelection as a6, KritzelKeyboardHelper as a7, KritzelToolRegistry as a8, KritzelGeometryHelper as a9, baseKeymap as aa, KritzelBaseTool as ab, KritzelEventHelper as ac, KritzelIconRegistry as ad, KritzelBaseHandler as ae, KritzelSelectionBox as af, KritzelSelectionGroup as ag, Doc as ah, DEFAULT_SYNC_CONFIG as ai, UndoManager as aj, ObjectHelper as ak, KritzelClassHelper as al, readVarUint8Array$2 as b, applyUpdate as c, encodeStateVector as d, encodeStateAsUpdate as e, createEncoder$1 as f, createDecoder$1 as g, create$8 as h, fromBase64 as i, toBase64 as j, createUint8ArrayFromArrayBuffer as k, offChange as l, readVarString$2 as m, floor$2 as n, onChange as o, getUnixTime$1 as p, equalityDeep$1 as q, readVarUint$2 as r, setIfUndefined$1 as s, toUint8Array$1 as t, writeVarString$2 as u, varStorage as v, writeVarUint$2 as w, map as x, ObservableV2 as y, length$2 as z };
|