cursedbelt 1.0.0 → 2.5.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/client/index.js +1 -1
- package/dist/core/category/index.d.ts.map +1 -1
- package/dist/core/category/index.js +2 -1
- package/dist/core/category/index.js.map +1 -1
- package/dist/core/category/types.js +1 -1
- package/dist/core/category/types.js.map +1 -1
- package/dist/core/file-tree/fileTreeModel.d.ts +49 -0
- package/dist/core/file-tree/fileTreeModel.d.ts.map +1 -1
- package/dist/core/file-tree/fileTreeModel.js +84 -0
- package/dist/core/file-tree/fileTreeModel.js.map +1 -1
- package/dist/core/layout/index.js +1 -1
- package/dist/core/layout/index.js.map +1 -1
- package/dist/core/media/index.js +1 -1
- package/dist/core/media/index.js.map +1 -1
- package/dist/core/media/types.js +1 -1
- package/dist/core/media/types.js.map +1 -1
- package/dist/core/media/uploadLimits.js +1 -1
- package/dist/core/media/uploadLimits.js.map +1 -1
- package/dist/core/sharing/model.d.ts +1 -1
- package/dist/ctgr/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/react/activity-bar/ActivityBar.d.ts +17 -0
- package/dist/react/activity-bar/ActivityBar.d.ts.map +1 -1
- package/dist/react/activity-bar/ActivityBar.js.map +1 -1
- package/dist/react/analytics/index.d.ts +1 -1
- package/dist/react/analytics/index.js +1 -1
- package/dist/react/chat/MessageComposer.d.ts.map +1 -1
- package/dist/react/chat/MessageComposer.js +5 -4
- package/dist/react/chat/MessageComposer.js.map +1 -1
- package/dist/react/components/Button.d.ts.map +1 -1
- package/dist/react/components/Button.js +3 -2
- package/dist/react/components/Button.js.map +1 -1
- package/dist/react/components/Checkbox.d.ts +19 -3
- package/dist/react/components/Checkbox.d.ts.map +1 -1
- package/dist/react/components/Checkbox.js +29 -12
- package/dist/react/components/Checkbox.js.map +1 -1
- package/dist/react/components/CodeArea.d.ts.map +1 -1
- package/dist/react/components/CodeArea.js +2 -1
- package/dist/react/components/CodeArea.js.map +1 -1
- package/dist/react/components/Collapsible.d.ts.map +1 -1
- package/dist/react/components/Collapsible.js +2 -1
- package/dist/react/components/Collapsible.js.map +1 -1
- package/dist/react/components/ComboboxField.d.ts.map +1 -1
- package/dist/react/components/ComboboxField.js +3 -2
- package/dist/react/components/ComboboxField.js.map +1 -1
- package/dist/react/components/CopyButton.d.ts.map +1 -1
- package/dist/react/components/CopyButton.js +2 -1
- package/dist/react/components/CopyButton.js.map +1 -1
- package/dist/react/components/DataTable/ColumnChecklist.d.ts.map +1 -1
- package/dist/react/components/DataTable/ColumnChecklist.js +2 -1
- package/dist/react/components/DataTable/ColumnChecklist.js.map +1 -1
- package/dist/react/components/DataTable/Pagination.d.ts.map +1 -1
- package/dist/react/components/DataTable/Pagination.js +2 -1
- package/dist/react/components/DataTable/Pagination.js.map +1 -1
- package/dist/react/components/DataTable/SortHeader.d.ts.map +1 -1
- package/dist/react/components/DataTable/SortHeader.js +2 -1
- package/dist/react/components/DataTable/SortHeader.js.map +1 -1
- package/dist/react/components/DataTable/TableFilterBuilder.d.ts +61 -0
- package/dist/react/components/DataTable/TableFilterBuilder.d.ts.map +1 -0
- package/dist/react/components/DataTable/{FilterBuilder.js → TableFilterBuilder.js} +26 -3
- package/dist/react/components/DataTable/TableFilterBuilder.js.map +1 -0
- package/dist/react/components/DataTable/Toolbar.d.ts +1 -1
- package/dist/react/components/DataTable/Toolbar.js +3 -3
- package/dist/react/components/DataTable/Toolbar.js.map +1 -1
- package/dist/react/components/DataTable/cells/LinkCell.d.ts.map +1 -1
- package/dist/react/components/DataTable/cells/LinkCell.js +2 -1
- package/dist/react/components/DataTable/cells/LinkCell.js.map +1 -1
- package/dist/react/components/DataTable/index.d.ts +1 -1
- package/dist/react/components/DataTable/index.d.ts.map +1 -1
- package/dist/react/components/DataTable/index.js +4 -1
- package/dist/react/components/DataTable/index.js.map +1 -1
- package/dist/react/components/DragHandle.d.ts.map +1 -1
- package/dist/react/components/DragHandle.js +2 -1
- package/dist/react/components/DragHandle.js.map +1 -1
- package/dist/react/components/EmojiField.d.ts.map +1 -1
- package/dist/react/components/EmojiField.js +2 -1
- package/dist/react/components/EmojiField.js.map +1 -1
- package/dist/react/components/EventTimeline.d.ts +3 -2
- package/dist/react/components/EventTimeline.d.ts.map +1 -1
- package/dist/react/components/EventTimeline.js +3 -2
- package/dist/react/components/EventTimeline.js.map +1 -1
- package/dist/react/components/IconButton.d.ts +1 -1
- package/dist/react/components/IconButton.js +1 -1
- package/dist/react/components/InfoHint.d.ts.map +1 -1
- package/dist/react/components/InfoHint.js +5 -4
- package/dist/react/components/InfoHint.js.map +1 -1
- package/dist/react/components/InheritBadge.js +1 -1
- package/dist/react/components/InheritBadge.js.map +1 -1
- package/dist/react/components/InlineEditableText.d.ts.map +1 -1
- package/dist/react/components/InlineEditableText.js +2 -1
- package/dist/react/components/InlineEditableText.js.map +1 -1
- package/dist/react/components/MeterList.d.ts.map +1 -1
- package/dist/react/components/MeterList.js +2 -1
- package/dist/react/components/MeterList.js.map +1 -1
- package/dist/react/components/PathText.d.ts +2 -2
- package/dist/react/components/PathText.d.ts.map +1 -1
- package/dist/react/components/PathText.js +2 -1
- package/dist/react/components/PathText.js.map +1 -1
- package/dist/react/components/RatingField.d.ts.map +1 -1
- package/dist/react/components/RatingField.js +2 -1
- package/dist/react/components/RatingField.js.map +1 -1
- package/dist/react/components/SecretInput.js +3 -2
- package/dist/react/components/SecretInput.js.map +1 -1
- package/dist/react/components/SegmentedControl.d.ts.map +1 -1
- package/dist/react/components/SegmentedControl.js +2 -1
- package/dist/react/components/SegmentedControl.js.map +1 -1
- package/dist/react/components/StarRating.d.ts.map +1 -1
- package/dist/react/components/StarRating.js +9 -5
- package/dist/react/components/StarRating.js.map +1 -1
- package/dist/react/components/StatStrip.d.ts.map +1 -1
- package/dist/react/components/StatStrip.js +2 -1
- package/dist/react/components/StatStrip.js.map +1 -1
- package/dist/react/components/StatTile.d.ts.map +1 -1
- package/dist/react/components/StatTile.js +3 -2
- package/dist/react/components/StatTile.js.map +1 -1
- package/dist/react/components/Tabs.d.ts.map +1 -1
- package/dist/react/components/Tabs.js +2 -1
- package/dist/react/components/Tabs.js.map +1 -1
- package/dist/react/components/TruncatedText.d.ts +2 -1
- package/dist/react/components/TruncatedText.d.ts.map +1 -1
- package/dist/react/components/TruncatedText.js +2 -1
- package/dist/react/components/TruncatedText.js.map +1 -1
- package/dist/react/components/calendar/MonthGrid.d.ts.map +1 -1
- package/dist/react/components/calendar/MonthGrid.js +2 -1
- package/dist/react/components/calendar/MonthGrid.js.map +1 -1
- package/dist/react/components/calendar/WeekView.d.ts.map +1 -1
- package/dist/react/components/calendar/WeekView.js +2 -1
- package/dist/react/components/calendar/WeekView.js.map +1 -1
- package/dist/react/components/revealOnHover.d.ts.map +1 -1
- package/dist/react/components/revealOnHover.js +2 -1
- package/dist/react/components/revealOnHover.js.map +1 -1
- package/dist/react/file-tree/FileTree.d.ts +50 -1
- package/dist/react/file-tree/FileTree.d.ts.map +1 -1
- package/dist/react/file-tree/FileTree.js +234 -6
- package/dist/react/file-tree/FileTree.js.map +1 -1
- package/dist/react/file-tree/fileTree.css +52 -0
- package/dist/react/filter-rail/FilterRail.d.ts.map +1 -1
- package/dist/react/filter-rail/FilterRail.js +5 -4
- package/dist/react/filter-rail/FilterRail.js.map +1 -1
- package/dist/react/folder-tree/FolderTreeRail.d.ts.map +1 -1
- package/dist/react/folder-tree/FolderTreeRail.js +2 -1
- package/dist/react/folder-tree/FolderTreeRail.js.map +1 -1
- package/dist/react/index.d.ts +5 -1
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +5 -1
- package/dist/react/index.js.map +1 -1
- package/dist/react/layoutEngine/index.js +1 -1
- package/dist/react/layoutEngine/index.js.map +1 -1
- package/dist/react/lib/field.d.ts.map +1 -1
- package/dist/react/lib/field.js +3 -2
- package/dist/react/lib/field.js.map +1 -1
- package/dist/react/lib/floatingStyles.d.ts.map +1 -1
- package/dist/react/lib/floatingStyles.js +2 -1
- package/dist/react/lib/floatingStyles.js.map +1 -1
- package/dist/react/lib/tapTarget.d.ts +96 -0
- package/dist/react/lib/tapTarget.d.ts.map +1 -0
- package/dist/react/lib/tapTarget.js +96 -0
- package/dist/react/lib/tapTarget.js.map +1 -0
- package/dist/react/media/VideoTrimmer.d.ts +1 -1
- package/dist/react/media/VideoTrimmer.js +1 -1
- package/dist/react/media/denseGallery.css +3 -3
- package/dist/react/media/ffmpegWasm.js +2 -2
- package/dist/react/media/ffmpegWasm.js.map +1 -1
- package/dist/react/media/videoPlayer.css +42 -0
- package/dist/react/namespace/NamespaceTargetCapsule.d.ts +2 -2
- package/dist/react/namespace/NamespaceTargetCapsule.d.ts.map +1 -1
- package/dist/react/nav/BreadcrumbTrail.d.ts.map +1 -1
- package/dist/react/nav/BreadcrumbTrail.js +4 -3
- package/dist/react/nav/BreadcrumbTrail.js.map +1 -1
- package/dist/react/nav/HubTileGrid.d.ts.map +1 -1
- package/dist/react/nav/HubTileGrid.js +2 -1
- package/dist/react/nav/HubTileGrid.js.map +1 -1
- package/dist/react/nav/SideNav.d.ts.map +1 -1
- package/dist/react/nav/SideNav.js +4 -3
- package/dist/react/nav/SideNav.js.map +1 -1
- package/dist/react/nav/SideNavCustomize.d.ts.map +1 -1
- package/dist/react/nav/SideNavCustomize.js +2 -1
- package/dist/react/nav/SideNavCustomize.js.map +1 -1
- package/dist/react/palette/CommandPalette.d.ts.map +1 -1
- package/dist/react/palette/CommandPalette.js +3 -2
- package/dist/react/palette/CommandPalette.js.map +1 -1
- package/dist/server/drivers/pooledControlStores.pg.test.js +1 -0
- package/dist/server/drivers/pooledControlStores.pg.test.js.map +1 -1
- package/dist/server/drivers/pooledIdentityStore.pg.test.js +1 -0
- package/dist/server/drivers/pooledIdentityStore.pg.test.js.map +1 -1
- package/dist/server/drivers/retentionPolicy.pg.test.js +1 -0
- package/dist/server/drivers/retentionPolicy.pg.test.js.map +1 -1
- package/dist/server/guard/argon2Binding.d.ts +1 -1
- package/dist/server/guard/argon2Binding.js +1 -1
- package/dist/server/incidents/store.d.ts +3 -3
- package/dist/server/index.js +1 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/master-lock/masterLock.d.ts +1 -1
- package/dist/server/media-bun/index.js +1 -1
- package/dist/server/media-bun/index.js.map +1 -1
- package/dist/server/paths/appDataHome.d.ts +20 -0
- package/dist/server/paths/appDataHome.d.ts.map +1 -0
- package/dist/server/paths/appDataHome.js +69 -0
- package/dist/server/paths/appDataHome.js.map +1 -0
- package/dist/server/retention/archive.d.ts +3 -4
- package/dist/server/retention/archive.d.ts.map +1 -1
- package/dist/server/retention/archive.js +20 -15
- package/dist/server/retention/archive.js.map +1 -1
- package/dist/server/retention/index.d.ts +1 -1
- package/dist/server/retention/index.js +1 -1
- package/dist/server/retention/policy.d.ts +2 -2
- package/dist/server/retention/policy.d.ts.map +1 -1
- package/dist/server/retention/policy.js +1 -1
- package/dist/server/retention/store.d.ts.map +1 -1
- package/dist/server/retention/store.js +27 -20
- package/dist/server/retention/store.js.map +1 -1
- package/dist/server/runtime/localHost.d.ts +10 -5
- package/dist/server/runtime/localHost.d.ts.map +1 -1
- package/dist/server/runtime/localHost.js +12 -8
- package/dist/server/runtime/localHost.js.map +1 -1
- package/dist/server/runtime/meterRollup.pg.test.js +1 -0
- package/dist/server/runtime/meterRollup.pg.test.js.map +1 -1
- package/dist/server/runtime/recipe.d.ts +4 -4
- package/dist/server/runtime/retentionJob.pg.test.js +1 -0
- package/dist/server/runtime/retentionJob.pg.test.js.map +1 -1
- package/dist/server/search/pgSearchProvider.pg.test.js +1 -0
- package/dist/server/search/pgSearchProvider.pg.test.js.map +1 -1
- package/dist/shared/errors.d.ts +1 -1
- package/dist/shared/errors.js +1 -1
- package/dist/styles-static.css +413 -0
- package/dist/styles-utilities.css +5074 -0
- package/dist/styles.css +49 -0
- package/package.json +30 -168
- package/scripts/generateStaticStyles.ts +122 -0
- package/scripts/generateUtilityStyles.ts +215 -0
- package/scripts/publicSurface.ts +455 -0
- package/scripts/testTmpRoot.ts +34 -5
- package/src/client/index.ts +1 -1
- package/src/core/category/index.ts +2 -1
- package/src/core/category/types.ts +1 -1
- package/src/core/file-tree/fileTreeModel.spec.ts +134 -0
- package/src/core/file-tree/fileTreeModel.ts +104 -0
- package/src/core/layout/index.ts +1 -1
- package/src/core/media/index.ts +1 -1
- package/src/core/media/types.ts +1 -1
- package/src/core/media/uploadLimits.ts +1 -1
- package/src/core/sharing/model.ts +1 -1
- package/src/ctgr/index.ts +1 -1
- package/src/declaredDepsAreImported.spec.ts +87 -0
- package/src/demoFixture.spec.ts +133 -0
- package/src/index.ts +1 -1
- package/src/lockfileIsTracked.spec.ts +50 -0
- package/src/namedSubpathsResolve.spec.ts +119 -0
- package/src/publicSurface.spec.ts +72 -0
- package/src/react/activity-bar/ActivityBar.tsx +17 -0
- package/src/react/analytics/index.ts +1 -1
- package/src/react/chat/MessageComposer.tsx +5 -4
- package/src/react/components/Button.tsx +3 -2
- package/src/react/components/Checkbox.spec.tsx +51 -0
- package/src/react/components/Checkbox.tsx +68 -26
- package/src/react/components/CodeArea.tsx +2 -1
- package/src/react/components/CodeChip.spec.tsx +2 -2
- package/src/react/components/Collapsible.tsx +2 -1
- package/src/react/components/ComboboxField.tsx +3 -2
- package/src/react/components/CopyButton.tsx +2 -1
- package/src/react/components/CopyableText.spec.tsx +1 -1
- package/src/react/components/DataTable/ColumnChecklist.tsx +2 -1
- package/src/react/components/DataTable/Pagination.tsx +2 -1
- package/src/react/components/DataTable/SortHeader.tsx +2 -1
- package/src/react/components/DataTable/{FilterBuilder.tsx → TableFilterBuilder.tsx} +33 -5
- package/src/react/components/DataTable/Toolbar.tsx +3 -3
- package/src/react/components/DataTable/cells/LinkCell.tsx +2 -1
- package/src/react/components/DataTable/index.ts +8 -1
- package/src/react/components/DragHandle.tsx +2 -1
- package/src/react/components/EmojiField.tsx +2 -1
- package/src/react/components/EventTimeline.tsx +3 -2
- package/src/react/components/FileLocation.spec.tsx +1 -1
- package/src/react/components/IconButton.tsx +1 -1
- package/src/react/components/InfoHint.tsx +5 -4
- package/src/react/components/InheritBadge.tsx +1 -1
- package/src/react/components/InlineEditableText.tsx +2 -1
- package/src/react/components/MeterList.tsx +2 -1
- package/src/react/components/PathText.tsx +4 -3
- package/src/react/components/RatingField.tsx +2 -1
- package/src/react/components/SecretInput.tsx +3 -3
- package/src/react/components/SegmentedControl.tsx +2 -2
- package/src/react/components/StarRating.spec.tsx +2 -2
- package/src/react/components/StarRating.tsx +9 -5
- package/src/react/components/StatStrip.tsx +2 -1
- package/src/react/components/StatTile.tsx +3 -3
- package/src/react/components/Tabs.spec.tsx +3 -2
- package/src/react/components/Tabs.tsx +2 -1
- package/src/react/components/TruncatedText.tsx +2 -1
- package/src/react/components/calendar/MonthGrid.spec.tsx +2 -1
- package/src/react/components/calendar/MonthGrid.tsx +2 -1
- package/src/react/components/calendar/WeekView.tsx +2 -1
- package/src/react/components/revealOnHover.ts +3 -2
- package/src/react/file-tree/FileTree.spec.tsx +248 -0
- package/src/react/file-tree/FileTree.tsx +304 -4
- package/src/react/file-tree/fileTree.css +52 -0
- package/src/react/file-tree/fileTreeGeometry.fixture.json +151 -0
- package/src/react/file-tree/fileTreeGeometry.spec.ts +33 -52
- package/src/react/filter-rail/FilterRail.spec.tsx +2 -1
- package/src/react/filter-rail/FilterRail.tsx +5 -4
- package/src/react/folder-tree/FolderTreeRail.tsx +2 -1
- package/src/react/index.ts +13 -3
- package/src/react/layoutEngine/index.ts +1 -1
- package/src/react/layoutEngine/types.ts +1 -1
- package/src/react/lib/field.ts +4 -2
- package/src/react/lib/floatingStyles.spec.ts +2 -1
- package/src/react/lib/floatingStyles.ts +3 -1
- package/src/react/lib/tapTarget.ts +100 -0
- package/src/react/media/MaskPainter.tsx +2 -2
- package/src/react/media/VideoTrimmer.tsx +1 -1
- package/src/react/media/denseGallery.css +3 -3
- package/src/react/media/ffmpegWasm.ts +2 -2
- package/src/react/media/videoPlayer.css +42 -0
- package/src/react/namespace/NamespaceTargetCapsule.tsx +2 -2
- package/src/react/nav/BreadcrumbTrail.tsx +4 -3
- package/src/react/nav/HubTileGrid.tsx +2 -1
- package/src/react/nav/SideNav.tsx +4 -3
- package/src/react/nav/SideNavCustomize.tsx +2 -1
- package/src/react/palette/CommandPalette.tsx +3 -2
- package/src/server/ctgr.ts +1 -1
- package/src/server/drivers/pooledControlStores.pg.test.ts +1 -0
- package/src/server/drivers/pooledIdentityStore.pg.test.ts +1 -0
- package/src/server/drivers/retentionPolicy.pg.test.ts +1 -0
- package/src/server/guard/argon2Binding.ts +1 -1
- package/src/server/incidents/store.ts +3 -3
- package/src/server/index.ts +1 -1
- package/src/server/master-lock/masterLock.spec.ts +18 -2
- package/src/server/master-lock/masterLock.ts +1 -1
- package/src/server/media-bun/image.spec.ts +1 -0
- package/src/server/media-bun/index.ts +1 -1
- package/src/server/media-bun/video.spec.ts +1 -0
- package/src/server/paths/appDataHome.spec.ts +87 -0
- package/src/server/paths/appDataHome.ts +84 -0
- package/src/server/retention/archive.spec.ts +26 -4
- package/src/server/retention/archive.ts +20 -15
- package/src/server/retention/index.ts +1 -1
- package/src/server/retention/policy.ts +2 -2
- package/src/server/retention/store.spec.ts +38 -10
- package/src/server/retention/store.ts +26 -19
- package/src/server/runtime/localHost.spec.ts +22 -3
- package/src/server/runtime/localHost.ts +12 -9
- package/src/server/runtime/meterRollup.pg.test.ts +1 -0
- package/src/server/runtime/recipe.ts +4 -4
- package/src/server/runtime/retentionJob.pg.test.ts +1 -0
- package/src/server/search/pgSearchProvider.pg.test.ts +1 -0
- package/src/server/storage/binaryServerProcessing.integration.spec.ts +6 -2
- package/src/server/storage/chunked.integration.spec.ts +5 -2
- package/src/server/storage/fileUploadClient-chunked.integration.spec.ts +5 -2
- package/src/server/storage/files/adapter.photo.display.spec.ts +1 -0
- package/src/server/storage/imageThumbnail.spec.ts +1 -0
- package/src/server/storage/transcode.integration.spec.ts +5 -2
- package/src/server/storage/videoProcessor.posterOnly.spec.ts +1 -0
- package/src/shared/errors.ts +1 -1
- package/src/skippedTestsAreAnswered.spec.ts +215 -0
- package/src/styles-static.css +413 -0
- package/src/styles-utilities.css +5074 -0
- package/src/styles.css +49 -0
- package/src/stylesStaticMatches.spec.ts +134 -0
- package/src/stylesUtilitiesMatches.spec.ts +314 -0
- package/src/tapTargetStylesheet.spec.ts +150 -0
- package/src/testTmpRoot.spec.ts +102 -0
- package/dist/core/duplicates/index.d.ts +0 -116
- package/dist/core/duplicates/index.d.ts.map +0 -1
- package/dist/core/duplicates/index.js +0 -178
- package/dist/core/duplicates/index.js.map +0 -1
- package/dist/core/namespace/helpers.d.ts +0 -14
- package/dist/core/namespace/helpers.d.ts.map +0 -1
- package/dist/core/namespace/helpers.js +0 -29
- package/dist/core/namespace/helpers.js.map +0 -1
- package/dist/core/namespace/index.d.ts +0 -4
- package/dist/core/namespace/index.d.ts.map +0 -1
- package/dist/core/namespace/index.js +0 -6
- package/dist/core/namespace/index.js.map +0 -1
- package/dist/core/namespace/memoryStore.d.ts +0 -19
- package/dist/core/namespace/memoryStore.d.ts.map +0 -1
- package/dist/core/namespace/memoryStore.js +0 -70
- package/dist/core/namespace/memoryStore.js.map +0 -1
- package/dist/core/namespace/types.d.ts +0 -44
- package/dist/core/namespace/types.d.ts.map +0 -1
- package/dist/core/namespace/types.js +0 -8
- package/dist/core/namespace/types.js.map +0 -1
- package/dist/game/core/DisposeRegistry.d.ts +0 -42
- package/dist/game/core/DisposeRegistry.d.ts.map +0 -1
- package/dist/game/core/DisposeRegistry.js +0 -67
- package/dist/game/core/DisposeRegistry.js.map +0 -1
- package/dist/game/core/drawBudget.d.ts +0 -26
- package/dist/game/core/drawBudget.d.ts.map +0 -1
- package/dist/game/core/drawBudget.js +0 -55
- package/dist/game/core/drawBudget.js.map +0 -1
- package/dist/game/core/fixedTimestep.d.ts +0 -38
- package/dist/game/core/fixedTimestep.d.ts.map +0 -1
- package/dist/game/core/fixedTimestep.js +0 -47
- package/dist/game/core/fixedTimestep.js.map +0 -1
- package/dist/game/core/index.d.ts +0 -9
- package/dist/game/core/index.d.ts.map +0 -1
- package/dist/game/core/index.js +0 -8
- package/dist/game/core/index.js.map +0 -1
- package/dist/game/core/inputCollector.d.ts +0 -82
- package/dist/game/core/inputCollector.d.ts.map +0 -1
- package/dist/game/core/inputCollector.js +0 -176
- package/dist/game/core/inputCollector.js.map +0 -1
- package/dist/game/core/resizeCanvas.d.ts +0 -19
- package/dist/game/core/resizeCanvas.d.ts.map +0 -1
- package/dist/game/core/resizeCanvas.js +0 -29
- package/dist/game/core/resizeCanvas.js.map +0 -1
- package/dist/game/react/index.d.ts +0 -3
- package/dist/game/react/index.d.ts.map +0 -1
- package/dist/game/react/index.js +0 -5
- package/dist/game/react/index.js.map +0 -1
- package/dist/game/react/useGameEngine.d.ts +0 -64
- package/dist/game/react/useGameEngine.d.ts.map +0 -1
- package/dist/game/react/useGameEngine.js +0 -78
- package/dist/game/react/useGameEngine.js.map +0 -1
- package/dist/react/canvas/CanvasNavHUD.d.ts +0 -64
- package/dist/react/canvas/CanvasNavHUD.d.ts.map +0 -1
- package/dist/react/canvas/CanvasNavHUD.js +0 -58
- package/dist/react/canvas/CanvasNavHUD.js.map +0 -1
- package/dist/react/canvas/fitLabel.d.ts +0 -53
- package/dist/react/canvas/fitLabel.d.ts.map +0 -1
- package/dist/react/canvas/fitLabel.js +0 -104
- package/dist/react/canvas/fitLabel.js.map +0 -1
- package/dist/react/canvas/index.d.ts +0 -4
- package/dist/react/canvas/index.d.ts.map +0 -1
- package/dist/react/canvas/index.js +0 -4
- package/dist/react/canvas/index.js.map +0 -1
- package/dist/react/canvas/lod.d.ts +0 -40
- package/dist/react/canvas/lod.d.ts.map +0 -1
- package/dist/react/canvas/lod.js +0 -37
- package/dist/react/canvas/lod.js.map +0 -1
- package/dist/react/components/DataTable/FilterBuilder.d.ts +0 -38
- package/dist/react/components/DataTable/FilterBuilder.d.ts.map +0 -1
- package/dist/react/components/DataTable/FilterBuilder.js.map +0 -1
- package/dist/react/seo/HeadProvider.d.ts +0 -14
- package/dist/react/seo/HeadProvider.d.ts.map +0 -1
- package/dist/react/seo/HeadProvider.js +0 -44
- package/dist/react/seo/HeadProvider.js.map +0 -1
- package/dist/react/seo/applyHeadToDocument.d.ts +0 -3
- package/dist/react/seo/applyHeadToDocument.d.ts.map +0 -1
- package/dist/react/seo/applyHeadToDocument.js +0 -66
- package/dist/react/seo/applyHeadToDocument.js.map +0 -1
- package/dist/react/seo/index.d.ts +0 -3
- package/dist/react/seo/index.d.ts.map +0 -1
- package/dist/react/seo/index.js +0 -7
- package/dist/react/seo/index.js.map +0 -1
- package/dist/react/timeline/ClipView.d.ts +0 -29
- package/dist/react/timeline/ClipView.d.ts.map +0 -1
- package/dist/react/timeline/ClipView.js +0 -53
- package/dist/react/timeline/ClipView.js.map +0 -1
- package/dist/react/timeline/Playhead.d.ts +0 -16
- package/dist/react/timeline/Playhead.d.ts.map +0 -1
- package/dist/react/timeline/Playhead.js +0 -26
- package/dist/react/timeline/Playhead.js.map +0 -1
- package/dist/react/timeline/TimeRuler.d.ts +0 -21
- package/dist/react/timeline/TimeRuler.d.ts.map +0 -1
- package/dist/react/timeline/TimeRuler.js +0 -31
- package/dist/react/timeline/TimeRuler.js.map +0 -1
- package/dist/react/timeline/TimelineSurface.d.ts +0 -29
- package/dist/react/timeline/TimelineSurface.d.ts.map +0 -1
- package/dist/react/timeline/TimelineSurface.js +0 -56
- package/dist/react/timeline/TimelineSurface.js.map +0 -1
- package/dist/react/timeline/TrackLane.d.ts +0 -31
- package/dist/react/timeline/TrackLane.d.ts.map +0 -1
- package/dist/react/timeline/TrackLane.js +0 -32
- package/dist/react/timeline/TrackLane.js.map +0 -1
- package/dist/react/timeline/index.d.ts +0 -6
- package/dist/react/timeline/index.d.ts.map +0 -1
- package/dist/react/timeline/index.js +0 -12
- package/dist/react/timeline/index.js.map +0 -1
- package/dist/server/private-media/index.d.ts +0 -7
- package/dist/server/private-media/index.d.ts.map +0 -1
- package/dist/server/private-media/index.js +0 -13
- package/dist/server/private-media/index.js.map +0 -1
- package/dist/server/seo/index.d.ts +0 -3
- package/dist/server/seo/index.d.ts.map +0 -1
- package/dist/server/seo/index.js +0 -6
- package/dist/server/seo/index.js.map +0 -1
- package/dist/server/seo/mountSeoRoutes.d.ts +0 -9
- package/dist/server/seo/mountSeoRoutes.d.ts.map +0 -1
- package/dist/server/seo/mountSeoRoutes.js +0 -19
- package/dist/server/seo/mountSeoRoutes.js.map +0 -1
- package/dist/server/seo/serveHeadInjectedIndex.d.ts +0 -9
- package/dist/server/seo/serveHeadInjectedIndex.d.ts.map +0 -1
- package/dist/server/seo/serveHeadInjectedIndex.js +0 -20
- package/dist/server/seo/serveHeadInjectedIndex.js.map +0 -1
- package/dist/upload.d.ts +0 -148
- package/dist/upload.d.ts.map +0 -1
- package/dist/upload.js +0 -159
- package/dist/upload.js.map +0 -1
- package/dist/verify/runtime/index.d.ts +0 -16
- package/dist/verify/runtime/index.d.ts.map +0 -1
- package/dist/verify/runtime/index.js +0 -16
- package/dist/verify/runtime/index.js.map +0 -1
- package/scripts/demoCheck.ts +0 -42
- package/src/core/duplicates/index.spec.ts +0 -116
- package/src/core/duplicates/index.ts +0 -203
- package/src/core/namespace/helpers.ts +0 -31
- package/src/core/namespace/index.ts +0 -12
- package/src/core/namespace/memoryStore.ts +0 -77
- package/src/core/namespace/namespace.spec.ts +0 -117
- package/src/core/namespace/types.ts +0 -53
- package/src/game/core/DisposeRegistry.spec.ts +0 -53
- package/src/game/core/DisposeRegistry.ts +0 -70
- package/src/game/core/drawBudget.spec.ts +0 -51
- package/src/game/core/drawBudget.ts +0 -75
- package/src/game/core/fixedTimestep.spec.ts +0 -91
- package/src/game/core/fixedTimestep.ts +0 -79
- package/src/game/core/index.ts +0 -16
- package/src/game/core/inputCollector.spec.ts +0 -29
- package/src/game/core/inputCollector.ts +0 -245
- package/src/game/core/resizeCanvas.ts +0 -31
- package/src/game/react/index.ts +0 -10
- package/src/game/react/useGameEngine.ts +0 -125
- package/src/react/canvas/CanvasNavHUD.spec.tsx +0 -62
- package/src/react/canvas/CanvasNavHUD.tsx +0 -210
- package/src/react/canvas/fitLabel.spec.ts +0 -82
- package/src/react/canvas/fitLabel.ts +0 -150
- package/src/react/canvas/index.ts +0 -15
- package/src/react/canvas/lod.ts +0 -53
- package/src/react/seo/HeadProvider.tsx +0 -67
- package/src/react/seo/applyHeadToDocument.ts +0 -73
- package/src/react/seo/index.ts +0 -12
- package/src/react/seo/seo.spec.tsx +0 -101
- package/src/react/timeline/ClipView.tsx +0 -146
- package/src/react/timeline/Playhead.tsx +0 -63
- package/src/react/timeline/TimeRuler.tsx +0 -85
- package/src/react/timeline/TimelineSurface.tsx +0 -157
- package/src/react/timeline/TrackLane.tsx +0 -87
- package/src/react/timeline/index.ts +0 -12
- package/src/react/timeline/timeline.spec.tsx +0 -175
- package/src/server/private-media/index.ts +0 -45
- package/src/server/seo/index.ts +0 -8
- package/src/server/seo/mountSeoRoutes.ts +0 -37
- package/src/server/seo/seo.spec.ts +0 -128
- package/src/server/seo/serveHeadInjectedIndex.ts +0 -36
- package/src/upload.spec.ts +0 -300
- package/src/upload.ts +0 -288
- package/src/verify/runtime/index.ts +0 -64
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The shared duplicate rules, proved against the cases that produced them.
|
|
3
|
-
*
|
|
4
|
-
* Every assertion here is a measured incident from `binary-server` or `music`, not an
|
|
5
|
-
* invented example — see the module header for which.
|
|
6
|
-
*/
|
|
7
|
-
import { describe, expect, it } from "bun:test";
|
|
8
|
-
import {
|
|
9
|
-
DURATION_TOLERANCE,
|
|
10
|
-
durationsClose,
|
|
11
|
-
isGenericName,
|
|
12
|
-
likelyTheSameFile,
|
|
13
|
-
normalizeName,
|
|
14
|
-
SIZE_TOLERANCE,
|
|
15
|
-
sizesClose,
|
|
16
|
-
} from "./index";
|
|
17
|
-
|
|
18
|
-
describe("normalizeName", () => {
|
|
19
|
-
it("reduces the marks a copy picks up to the same stem", () => {
|
|
20
|
-
expect(normalizeName("My Video (1).mp4")).toBe("myvideo");
|
|
21
|
-
expect(normalizeName("my_video.MP4")).toBe("myvideo");
|
|
22
|
-
expect(normalizeName("My-Video copy 2.mov")).toBe("myvideo");
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it("strips the extension, so a re-encode still pairs with its source", () => {
|
|
26
|
-
expect(normalizeName("Song.wma")).toBe(normalizeName("Song.mp3"));
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it("🔴 keeps a four-digit camera sequence — the 2026-08-14 flood", () => {
|
|
30
|
-
// `IMG_4595` and `IMG_4646` must NOT collapse onto each other.
|
|
31
|
-
expect(normalizeName("IMG_4595.MOV")).not.toBe(normalizeName("IMG_4646.MOV"));
|
|
32
|
-
// …while a two-digit copy marker still does.
|
|
33
|
-
expect(normalizeName("mix_2.mp3")).toBe(normalizeName("mix.mp3"));
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it("drops the directory", () => {
|
|
37
|
-
expect(normalizeName("Main 1/rap/Song.mp3")).toBe("song");
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
describe("isGenericName", () => {
|
|
42
|
-
it("rejects the stems that name a device rather than a file", () => {
|
|
43
|
-
expect(isGenericName(normalizeName("IMG_1.MOV"))).toBe(true);
|
|
44
|
-
expect(isGenericName(normalizeName("Track01.mp3"))).toBe(true);
|
|
45
|
-
expect(isGenericName(normalizeName("Between U.mp3"))).toBe(false);
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
describe("sizesClose", () => {
|
|
50
|
-
it("accepts a re-encode and refuses a different file", () => {
|
|
51
|
-
expect(sizesClose(10_000_000, 10_400_000)).toBe(true);
|
|
52
|
-
expect(sizesClose(10_000_000, 20_000_000)).toBe(false);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it("🔴 two zero-byte files are not close — nothing is known about either", () => {
|
|
56
|
-
expect(sizesClose(0, 0)).toBe(false);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it("is bounded by the exported tolerance", () => {
|
|
60
|
-
expect(sizesClose(100, 100 * (1 + SIZE_TOLERANCE))).toBe(true);
|
|
61
|
-
expect(sizesClose(100, 100 * (1 + SIZE_TOLERANCE * 2))).toBe(false);
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
describe("durationsClose", () => {
|
|
66
|
-
it("🔴 answers null when nobody has measured, never false", () => {
|
|
67
|
-
expect(durationsClose(null, 200)).toBeNull();
|
|
68
|
-
expect(durationsClose(0, 200)).toBeNull();
|
|
69
|
-
expect(durationsClose(undefined, undefined)).toBeNull();
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it("refuses the owner's 3:56-vs-1:52 pair", () => {
|
|
73
|
-
expect(durationsClose(236, 112)).toBe(false);
|
|
74
|
-
expect(durationsClose(236, 236 * (1 + DURATION_TOLERANCE / 2))).toBe(true);
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
describe("likelyTheSameFile", () => {
|
|
79
|
-
const facts = (name: string, sizeBytes: number, duration?: number | null) => ({
|
|
80
|
-
name,
|
|
81
|
-
sizeBytes,
|
|
82
|
-
...(duration === undefined ? {} : { duration }),
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it("pairs a re-encode of the same song", () => {
|
|
86
|
-
const verdict = likelyTheSameFile(
|
|
87
|
-
facts("Between U.mp3", 8_000_000, 312),
|
|
88
|
-
facts("Between U.wma", 7_800_000, 312),
|
|
89
|
-
);
|
|
90
|
-
expect(verdict.match).toBe(true);
|
|
91
|
-
expect(verdict.reason).toContain("same name");
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
it("does not pair two different songs of a similar size", () => {
|
|
95
|
-
expect(likelyTheSameFile(facts("A.mp3", 8_000_000), facts("B.mp3", 8_010_000)).match).toBe(
|
|
96
|
-
false,
|
|
97
|
-
);
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
it("🔴 a length that disagrees kills a name+size match", () => {
|
|
101
|
-
expect(
|
|
102
|
-
likelyTheSameFile(facts("Set.mp3", 8_000_000, 236), facts("Set.mp3", 8_100_000, 112)).match,
|
|
103
|
-
).toBe(false);
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it("🔴 an unmeasured length does not — that would find nothing in an unprobed library", () => {
|
|
107
|
-
expect(
|
|
108
|
-
likelyTheSameFile(facts("Set.mp3", 8_000_000, null), facts("Set.mp3", 8_100_000, null)).match,
|
|
109
|
-
).toBe(true);
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
it("refuses a generic stem, and refuses two nameless files", () => {
|
|
113
|
-
expect(likelyTheSameFile(facts("IMG_1.MOV", 500), facts("IMG_1.MOV", 500)).match).toBe(false);
|
|
114
|
-
expect(likelyTheSameFile(facts("", 500), facts("", 500)).match).toBe(false);
|
|
115
|
-
});
|
|
116
|
-
});
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* "Are these two files the same thing?" — the fleet's ONE answer, with no I/O in it.
|
|
3
|
-
*
|
|
4
|
-
* ── Why this is here and not in an app ──────────────────────────────────────────────────
|
|
5
|
-
* `binary-server` wrote these rules first (2026-08-13, the owner: *"make strategy to always
|
|
6
|
-
* check for duplicate binaries in same app for same user … mark likely the duplicates for
|
|
7
|
-
* users to confirm"*), and they were measured against a real store: the copy-counter cap, the
|
|
8
|
-
* camera-generic stem list and the 5% size window each exist because a wider rule proposed
|
|
9
|
-
* thousands of pairs nobody could ever review. `music` then needed the same question asked of
|
|
10
|
-
* a 5,400-track library — *"I want to see a duplicate next to the file that it is a possible
|
|
11
|
-
* duplicate of … The 'binary-server' app (bs) already has this feature for checking duplicate
|
|
12
|
-
* files. We can reuse it and enhance the customizability if needed so the main strategy is
|
|
13
|
-
* shared."*
|
|
14
|
-
*
|
|
15
|
-
* So the strategy lives once, here, and both consume it. What each app keeps for itself is the
|
|
16
|
-
* evidence only it has: bs's perceptual frame hashes, music's artist/title key.
|
|
17
|
-
*
|
|
18
|
-
* ── What is NOT here, deliberately ──────────────────────────────────────────────────────
|
|
19
|
-
* Anything that needs a database, a filesystem, a fetch or a picture decoder. This module is
|
|
20
|
-
* pure so both consumers can prove their behaviour with `bun test` instead of against a live
|
|
21
|
-
* store, and so a browser bundle may import it (music renders the pair side by side).
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* How far two sizes may differ and still be called the same thing.
|
|
26
|
-
*
|
|
27
|
-
* A re-encode at a different quality is the case this exists for, and those land within a few
|
|
28
|
-
* percent. Zero would make a name match a strict subset of "same name AND same size", which
|
|
29
|
-
* misses precisely the files worth asking about; much larger starts pairing a clip with its
|
|
30
|
-
* own trailer.
|
|
31
|
-
*/
|
|
32
|
-
export const SIZE_TOLERANCE = 0.05;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* How far two playing times may differ and still be the same recording.
|
|
36
|
-
*
|
|
37
|
-
* Wide enough for a re-encode (a trim of a trailing black frame, a container that rounds), far
|
|
38
|
-
* too narrow for the owner's 2026-08-14 report of a 3:56 video paired with a 1:52 one.
|
|
39
|
-
*/
|
|
40
|
-
export const DURATION_TOLERANCE = 0.05;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* The name to compare, reduced to what a human means by "the same file".
|
|
44
|
-
*
|
|
45
|
-
* Strips the directory, the extension, and the marks a copy picks up along the way —
|
|
46
|
-
* `Finder`'s ` copy`/` copy 2`, a browser's ` (1)`, a script's `_1`/`-1` — then collapses
|
|
47
|
-
* everything that is not a letter or a digit. `My Video (1).mp4`, `my_video.MP4` and
|
|
48
|
-
* `My-Video copy 2.mov` all reduce to `myvideo`.
|
|
49
|
-
*
|
|
50
|
-
* 🔴 The extension is stripped ON PURPOSE, so a re-encode (`.mov` → `.mp4`, `.wma` → `.mp3`)
|
|
51
|
-
* still pairs with its source. That is the single most common likely-duplicate in this fleet's
|
|
52
|
-
* stores and a rule that kept the extension would never see one.
|
|
53
|
-
*
|
|
54
|
-
* 🔴 **The copy-counter strip is capped at two digits**, and that cap is a measured bug fix
|
|
55
|
-
* (bs, 2026-08-14). It used to be `[-_]\d+$`, which eats a CAMERA SEQUENCE as readily as a copy
|
|
56
|
-
* marker: `IMG_4595` and `IMG_4646` both reduced to `img`, so every iPhone capture in a tenant
|
|
57
|
-
* shared one bucket and paired with every other one whose size was within 5%. `_1`…`_99` is
|
|
58
|
-
* what a copy marker actually looks like; four digits is a photo's identity, and it must
|
|
59
|
-
* survive.
|
|
60
|
-
*/
|
|
61
|
-
export function normalizeName(name: string | null | undefined): string {
|
|
62
|
-
if (!name) return "";
|
|
63
|
-
const leaf = name.split(/[\\/]/).pop() ?? "";
|
|
64
|
-
const stem = leaf.replace(/\.[a-z0-9]{1,5}$/i, "");
|
|
65
|
-
return stem
|
|
66
|
-
.toLowerCase()
|
|
67
|
-
.replace(/\s*\(\d+\)\s*$/, "")
|
|
68
|
-
.replace(/\s+copy(\s+\d+)?\s*$/, "")
|
|
69
|
-
.replace(/[-_]\d{1,2}\s*$/, "")
|
|
70
|
-
.replace(/[^a-z0-9]+/g, "");
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Stems that name a CAMERA, not a file.
|
|
75
|
-
*
|
|
76
|
-
* `IMG`, `DSC`, `PXL`, `VID` are what a device calls everything it produces; two files whose
|
|
77
|
-
* names reduce to one of these have told us nothing except that they came from a phone. Even
|
|
78
|
-
* with the counter cap above, `IMG_1.MOV` still reduces to `img`, and a bucket called "img" is
|
|
79
|
-
* every photo the owner has ever taken.
|
|
80
|
-
*
|
|
81
|
-
* 🔴 This rejects a MATCH, never a file. Both copies stay wherever they are, and an
|
|
82
|
-
* identical-bytes pair is unaffected — a checksum match never consults the name.
|
|
83
|
-
*/
|
|
84
|
-
export const GENERIC_STEMS: ReadonlySet<string> = new Set([
|
|
85
|
-
"img",
|
|
86
|
-
"image",
|
|
87
|
-
"images",
|
|
88
|
-
"dsc",
|
|
89
|
-
"dscf",
|
|
90
|
-
"dscn",
|
|
91
|
-
"pxl",
|
|
92
|
-
"vid",
|
|
93
|
-
"video",
|
|
94
|
-
"movie",
|
|
95
|
-
"mov",
|
|
96
|
-
"photo",
|
|
97
|
-
"pic",
|
|
98
|
-
"picture",
|
|
99
|
-
"screenshot",
|
|
100
|
-
"screenrecording",
|
|
101
|
-
"untitled",
|
|
102
|
-
"unknown",
|
|
103
|
-
"file",
|
|
104
|
-
"download",
|
|
105
|
-
"scan",
|
|
106
|
-
"capture",
|
|
107
|
-
"copy",
|
|
108
|
-
"new",
|
|
109
|
-
"temp",
|
|
110
|
-
"tmp",
|
|
111
|
-
// Music's own version of the same problem: an untagged rip is called this by every ripper
|
|
112
|
-
// ever written, and `track01` from two albums is two different songs.
|
|
113
|
-
"track",
|
|
114
|
-
"audiotrack",
|
|
115
|
-
"unknownartist",
|
|
116
|
-
]);
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* A name that could belong to any file from that device tells us nothing about identity.
|
|
120
|
-
*
|
|
121
|
-
* 🔴 The trailing digit run is stripped BEFORE the lookup, and only here — never in
|
|
122
|
-
* {@link normalizeName}, where removing it is what made every camera capture one bucket. The
|
|
123
|
-
* two are asked at different moments: `normalizeName` decides whether two names are the SAME
|
|
124
|
-
* (so `img4595` and `img4646` must stay apart), and this decides whether a name that already
|
|
125
|
-
* matched is worth anything (so two files both called `Track01` have told us nothing, and a
|
|
126
|
-
* ripper names half a library that).
|
|
127
|
-
*/
|
|
128
|
-
export const isGenericName = (normalized: string): boolean =>
|
|
129
|
-
normalized.length < 3 ||
|
|
130
|
-
GENERIC_STEMS.has(normalized) ||
|
|
131
|
-
GENERIC_STEMS.has(normalized.replace(/\d+$/, ""));
|
|
132
|
-
|
|
133
|
-
/** Within {@link SIZE_TOLERANCE} of each other. Two zero-byte files are not "close" — they
|
|
134
|
-
* are two files nothing is known about. */
|
|
135
|
-
export function sizesClose(a: number, b: number, tolerance = SIZE_TOLERANCE): boolean {
|
|
136
|
-
if (a === b && a > 0) return true;
|
|
137
|
-
const larger = Math.max(a, b);
|
|
138
|
-
if (larger <= 0) return false;
|
|
139
|
-
return Math.abs(a - b) / larger <= tolerance;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Within {@link DURATION_TOLERANCE} of each other.
|
|
144
|
-
*
|
|
145
|
-
* 🔴 A missing or zero duration answers `null`, never `false`: "nobody has measured this yet"
|
|
146
|
-
* and "these are different lengths" are opposite answers, and collapsing them makes an
|
|
147
|
-
* unprobed library look like a library with no duplicates in it.
|
|
148
|
-
*/
|
|
149
|
-
export function durationsClose(
|
|
150
|
-
a: number | null | undefined,
|
|
151
|
-
b: number | null | undefined,
|
|
152
|
-
tolerance = DURATION_TOLERANCE,
|
|
153
|
-
): boolean | null {
|
|
154
|
-
if (!a || !b || a <= 0 || b <= 0) return null;
|
|
155
|
-
return Math.abs(a - b) / Math.max(a, b) <= tolerance;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/** One file, reduced to what this module can reason about. Units are the caller's — pass
|
|
159
|
-
* both durations in the same unit or not at all. */
|
|
160
|
-
export interface NamedFileFacts {
|
|
161
|
-
/** The name a person would recognise: a display title, else the last path segment. */
|
|
162
|
-
name: string | null | undefined;
|
|
163
|
-
sizeBytes: number;
|
|
164
|
-
/** Playing time, in whatever unit the caller uses consistently. Null = never measured. */
|
|
165
|
-
duration?: number | null;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
export interface NameMatchVerdict {
|
|
169
|
-
match: boolean;
|
|
170
|
-
/** Written for the owner reading a review queue, never for a log. Empty when `match` is
|
|
171
|
-
* false — a non-match has nothing to explain. */
|
|
172
|
-
reason: string;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* The shared "these look like the same thing" test: the NAME agrees after normalization, the
|
|
177
|
-
* sizes are close, and nothing about the length says otherwise.
|
|
178
|
-
*
|
|
179
|
-
* It is deliberately a QUESTION and never an action. Both consumers act only on a checksum,
|
|
180
|
-
* which is proof; this decides what is worth showing a person side by side.
|
|
181
|
-
*/
|
|
182
|
-
export function likelyTheSameFile(a: NamedFileFacts, b: NamedFileFacts): NameMatchVerdict {
|
|
183
|
-
const na = normalizeName(a.name);
|
|
184
|
-
const nb = normalizeName(b.name);
|
|
185
|
-
// Two empty names are not a match with each other — it means neither file has a name worth
|
|
186
|
-
// comparing (a bare digest key, an untitled upload), and pairing those proposes every
|
|
187
|
-
// unnamed object as a duplicate of every other.
|
|
188
|
-
if (!na || na !== nb) return { match: false, reason: "" };
|
|
189
|
-
if (isGenericName(na)) return { match: false, reason: "" };
|
|
190
|
-
if (!sizesClose(a.sizeBytes, b.sizeBytes)) return { match: false, reason: "" };
|
|
191
|
-
if (durationsClose(a.duration, b.duration) === false) return { match: false, reason: "" };
|
|
192
|
-
|
|
193
|
-
const pct = Math.round(
|
|
194
|
-
(Math.abs(a.sizeBytes - b.sizeBytes) / Math.max(a.sizeBytes, b.sizeBytes, 1)) * 100,
|
|
195
|
-
);
|
|
196
|
-
return {
|
|
197
|
-
match: true,
|
|
198
|
-
reason:
|
|
199
|
-
a.sizeBytes === b.sizeBytes
|
|
200
|
-
? "same name, same size, different bytes"
|
|
201
|
-
: `same name, size within ${pct}%, different bytes`,
|
|
202
|
-
};
|
|
203
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { Namespace } from './types';
|
|
2
|
-
|
|
3
|
-
/** Irrational angle (in degrees) whose repeated steps around a 360° wheel
|
|
4
|
-
* never re-align on a short cycle, so successive hues stay maximally spread
|
|
5
|
-
* regardless of how many namespaces already exist. */
|
|
6
|
-
const GOLDEN_ANGLE = 137.50776405003785;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Picks the next hue (0–359) for a new namespace by stepping around the color
|
|
10
|
-
* wheel by the golden angle once per existing namespace, then nudging past
|
|
11
|
-
* any exact collision with a hue already in use. Golden-angle stepping keeps
|
|
12
|
-
* consecutive hues far apart without tracking gaps explicitly.
|
|
13
|
-
*/
|
|
14
|
-
export function nextHue(existing: Namespace[]): number {
|
|
15
|
-
const used = new Set(existing.map((n) => n.hue));
|
|
16
|
-
let hue = Math.round((existing.length * GOLDEN_ANGLE) % 360);
|
|
17
|
-
while (used.has(hue)) {
|
|
18
|
-
hue = (hue + 1) % 360;
|
|
19
|
-
}
|
|
20
|
-
return hue;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Trims and collapses internal whitespace in a namespace label, caps it at 40
|
|
25
|
-
* characters, and rejects a label that is empty/blank after normalization.
|
|
26
|
-
*/
|
|
27
|
-
export function normalizeNamespaceLabel(label: string): string {
|
|
28
|
-
const normalized = label.trim().replace(/\s+/g, ' ').slice(0, 40);
|
|
29
|
-
if (!normalized) throw new Error('namespace label must not be empty');
|
|
30
|
-
return normalized;
|
|
31
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// `cursedbelt/namespace` — reusable flat namespace/workspace model. Pure and
|
|
2
|
-
// React-free (the switcher/picker UI lives in the consuming app), so servers
|
|
3
|
-
// can import the contract + store without pulling any UI runtime.
|
|
4
|
-
|
|
5
|
-
export type {
|
|
6
|
-
Namespace,
|
|
7
|
-
NamespaceCreateInput,
|
|
8
|
-
NamespaceStore,
|
|
9
|
-
NamespaceUpdateInput,
|
|
10
|
-
} from './types';
|
|
11
|
-
export { nextHue, normalizeNamespaceLabel } from './helpers';
|
|
12
|
-
export { createMemoryNamespaceStore } from './memoryStore';
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import type { Namespace, NamespaceCreateInput, NamespaceStore, NamespaceUpdateInput } from './types';
|
|
2
|
-
import { nextHue, normalizeNamespaceLabel } from './helpers';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Zero-config in-memory {@link NamespaceStore}: a single per-boot `Map`, so a
|
|
6
|
-
* host that wires nothing up still gets a working (non-persistent) namespace
|
|
7
|
-
* list — the same role `createMemoryCategoryStore` plays. Swap in a
|
|
8
|
-
* persistent store (f's `createSqliteNamespaceStore`) for real data.
|
|
9
|
-
*
|
|
10
|
-
* Deliberately not annotated `: NamespaceStore` — the interface allows async
|
|
11
|
-
* returns, which would force callers (and these tests) to `await` values that
|
|
12
|
-
* are always synchronous here. Structural typing keeps it assignable wherever
|
|
13
|
-
* a `NamespaceStore` is expected.
|
|
14
|
-
*/
|
|
15
|
-
export function createMemoryNamespaceStore(
|
|
16
|
-
idFactory: () => string = () => crypto.randomUUID(),
|
|
17
|
-
now: () => number = () => Date.now(),
|
|
18
|
-
) {
|
|
19
|
-
const byId = new Map<string, Namespace>();
|
|
20
|
-
|
|
21
|
-
const requireNamespace = (id: string): Namespace => {
|
|
22
|
-
const ns = byId.get(id);
|
|
23
|
-
if (!ns) throw new Error(`no namespace with id ${id}`);
|
|
24
|
-
return ns;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const nextOrd = (): number => {
|
|
28
|
-
let max = -1;
|
|
29
|
-
for (const ns of byId.values()) {
|
|
30
|
-
if (ns.ord > max) max = ns.ord;
|
|
31
|
-
}
|
|
32
|
-
return max + 1;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
list(): Namespace[] {
|
|
37
|
-
return [...byId.values()].sort((a, b) => {
|
|
38
|
-
if (a.archived !== b.archived) return a.archived ? 1 : -1;
|
|
39
|
-
return a.ord - b.ord;
|
|
40
|
-
});
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
create(input: NamespaceCreateInput): Namespace {
|
|
44
|
-
const existing = [...byId.values()];
|
|
45
|
-
const timestamp = now();
|
|
46
|
-
const namespace: Namespace = {
|
|
47
|
-
id: idFactory(),
|
|
48
|
-
label: normalizeNamespaceLabel(input.label),
|
|
49
|
-
hue: input.hue ?? nextHue(existing),
|
|
50
|
-
ord: nextOrd(),
|
|
51
|
-
archived: false,
|
|
52
|
-
createdAt: timestamp,
|
|
53
|
-
updatedAt: timestamp,
|
|
54
|
-
};
|
|
55
|
-
byId.set(namespace.id, namespace);
|
|
56
|
-
return namespace;
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
update(id: string, input: NamespaceUpdateInput): Namespace {
|
|
60
|
-
const ns = requireNamespace(id);
|
|
61
|
-
const updated: Namespace = {
|
|
62
|
-
...ns,
|
|
63
|
-
label: input.label !== undefined ? normalizeNamespaceLabel(input.label) : ns.label,
|
|
64
|
-
hue: input.hue ?? ns.hue,
|
|
65
|
-
ord: input.ord ?? ns.ord,
|
|
66
|
-
archived: input.archived ?? ns.archived,
|
|
67
|
-
updatedAt: now(),
|
|
68
|
-
};
|
|
69
|
-
byId.set(id, updated);
|
|
70
|
-
return updated;
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
remove(id: string): void {
|
|
74
|
-
byId.delete(id);
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'bun:test';
|
|
2
|
-
import { createMemoryNamespaceStore, nextHue, normalizeNamespaceLabel, type Namespace } from './index';
|
|
3
|
-
|
|
4
|
-
const ns = (id: string, ord: number, archived = false, hue = 0): Namespace => ({
|
|
5
|
-
id,
|
|
6
|
-
label: id,
|
|
7
|
-
hue,
|
|
8
|
-
ord,
|
|
9
|
-
archived,
|
|
10
|
-
createdAt: 0,
|
|
11
|
-
updatedAt: 0,
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
describe('createMemoryNamespaceStore', () => {
|
|
15
|
-
it('lists in ord order', () => {
|
|
16
|
-
let n = 0;
|
|
17
|
-
const store = createMemoryNamespaceStore(() => `id${++n}`);
|
|
18
|
-
const b = store.create({ label: 'B' });
|
|
19
|
-
const a = store.create({ label: 'A' });
|
|
20
|
-
store.update(a.id, { ord: 0 });
|
|
21
|
-
store.update(b.id, { ord: 1 });
|
|
22
|
-
expect(store.list().map((x) => x.id)).toEqual([a.id, b.id]);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('sorts archived namespaces after non-archived ones regardless of ord', () => {
|
|
26
|
-
let n = 0;
|
|
27
|
-
const store = createMemoryNamespaceStore(() => `id${++n}`);
|
|
28
|
-
const a = store.create({ label: 'A' });
|
|
29
|
-
const b = store.create({ label: 'B' });
|
|
30
|
-
store.update(a.id, { archived: true, ord: 0 });
|
|
31
|
-
store.update(b.id, { ord: 5 });
|
|
32
|
-
expect(store.list().map((x) => x.id)).toEqual([b.id, a.id]);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('creates with auto-incrementing ord and an assigned hue', () => {
|
|
36
|
-
const store = createMemoryNamespaceStore();
|
|
37
|
-
const a = store.create({ label: 'A' });
|
|
38
|
-
const b = store.create({ label: 'B' });
|
|
39
|
-
expect(a.ord).toBe(0);
|
|
40
|
-
expect(b.ord).toBe(1);
|
|
41
|
-
expect(a.hue).toBeGreaterThanOrEqual(0);
|
|
42
|
-
expect(a.hue).toBeLessThan(360);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('normalizes labels on create and update', () => {
|
|
46
|
-
const store = createMemoryNamespaceStore();
|
|
47
|
-
const a = store.create({ label: ' Multi Word ' });
|
|
48
|
-
expect(a.label).toBe('Multi Word');
|
|
49
|
-
const updated = store.update(a.id, { label: ' Renamed ' });
|
|
50
|
-
expect(updated.label).toBe('Renamed');
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('rejects a blank label', () => {
|
|
54
|
-
const store = createMemoryNamespaceStore();
|
|
55
|
-
expect(() => store.create({ label: ' ' })).toThrow();
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it('updates only the provided fields', () => {
|
|
59
|
-
const store = createMemoryNamespaceStore();
|
|
60
|
-
const a = store.create({ label: 'A', hue: 10 });
|
|
61
|
-
const updated = store.update(a.id, { archived: true });
|
|
62
|
-
expect(updated.label).toBe('A');
|
|
63
|
-
expect(updated.hue).toBe(10);
|
|
64
|
-
expect(updated.archived).toBe(true);
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it('removes a namespace', () => {
|
|
68
|
-
const store = createMemoryNamespaceStore();
|
|
69
|
-
const a = store.create({ label: 'A' });
|
|
70
|
-
store.remove(a.id);
|
|
71
|
-
expect(store.list()).toEqual([]);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
it('throws when updating an unknown id', () => {
|
|
75
|
-
const store = createMemoryNamespaceStore();
|
|
76
|
-
expect(() => store.update('ghost', { label: 'X' })).toThrow();
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
describe('nextHue', () => {
|
|
81
|
-
it('spreads hues across the wheel and avoids exact collisions', () => {
|
|
82
|
-
const existing: Namespace[] = [];
|
|
83
|
-
const hues: number[] = [];
|
|
84
|
-
for (let i = 0; i < 8; i++) {
|
|
85
|
-
const hue = nextHue(existing);
|
|
86
|
-
hues.push(hue);
|
|
87
|
-
existing.push(ns(`n${i}`, i, false, hue));
|
|
88
|
-
}
|
|
89
|
-
expect(new Set(hues).size).toBe(hues.length);
|
|
90
|
-
for (const hue of hues) {
|
|
91
|
-
expect(hue).toBeGreaterThanOrEqual(0);
|
|
92
|
-
expect(hue).toBeLessThan(360);
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
it('steps past an already-used hue instead of colliding', () => {
|
|
97
|
-
// With one existing namespace, the golden-angle step lands on hue 138 —
|
|
98
|
-
// occupy it so the collision-avoidance nudge is exercised.
|
|
99
|
-
const existing = [ns('a', 0, false, 138)];
|
|
100
|
-
expect(nextHue(existing)).toBe(139);
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
describe('normalizeNamespaceLabel', () => {
|
|
105
|
-
it('trims and collapses whitespace', () => {
|
|
106
|
-
expect(normalizeNamespaceLabel(' a b ')).toBe('a b');
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
it('caps at 40 characters', () => {
|
|
110
|
-
expect(normalizeNamespaceLabel('x'.repeat(50)).length).toBe(40);
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it('rejects empty and blank labels', () => {
|
|
114
|
-
expect(() => normalizeNamespaceLabel('')).toThrow();
|
|
115
|
-
expect(() => normalizeNamespaceLabel(' ')).toThrow();
|
|
116
|
-
});
|
|
117
|
-
});
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
// `cursedbelt/namespace` — a reusable, flat namespace/workspace model shared
|
|
2
|
-
// across content plugins (notes today; aliases/… later, see ns-03). React-free
|
|
3
|
-
// and storage-agnostic: the pure `Namespace` data + a host-injected
|
|
4
|
-
// `NamespaceStore` contract, mirroring `cursedbelt/category`'s split between a
|
|
5
|
-
// pure contract and a host-backed (SQLite) implementation. Importing this
|
|
6
|
-
// module on a server never pulls React.
|
|
7
|
-
|
|
8
|
-
/** A single namespace (colorway-tagged workspace). Namespaces are flat — no
|
|
9
|
-
* parent/child nesting, unlike `Category`. `hue` (0–359) is the colorway seed
|
|
10
|
-
* the UI derives all tints from. `ord` sorts non-archived namespaces
|
|
11
|
-
* ascending; archived namespaces always sort after non-archived ones. */
|
|
12
|
-
export interface Namespace {
|
|
13
|
-
id: string;
|
|
14
|
-
label: string;
|
|
15
|
-
hue: number;
|
|
16
|
-
ord: number;
|
|
17
|
-
archived: boolean;
|
|
18
|
-
createdAt: number;
|
|
19
|
-
updatedAt: number;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/** Fields a caller supplies when creating a namespace — the store assigns
|
|
23
|
-
* `id`, timestamps, and a default `hue`/`ord` when omitted. */
|
|
24
|
-
export interface NamespaceCreateInput {
|
|
25
|
-
label: string;
|
|
26
|
-
hue?: number;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/** Fields a caller supplies when updating a namespace — all optional, only
|
|
30
|
-
* the provided fields change. */
|
|
31
|
-
export interface NamespaceUpdateInput {
|
|
32
|
-
label?: string;
|
|
33
|
-
hue?: number;
|
|
34
|
-
ord?: number;
|
|
35
|
-
archived?: boolean;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Storage-agnostic namespace store. The host injects a real implementation
|
|
40
|
-
* (f backs it with SQLite, per-role); {@link createMemoryNamespaceStore} is
|
|
41
|
-
* the zero-config in-memory default.
|
|
42
|
-
*
|
|
43
|
-
* `remove` is a hard delete and is only legal when the caller has already
|
|
44
|
-
* verified no rows reference the namespace — callers should archive instead
|
|
45
|
-
* in the common case. A host-backed store enforces this by throwing when
|
|
46
|
-
* references still exist.
|
|
47
|
-
*/
|
|
48
|
-
export interface NamespaceStore {
|
|
49
|
-
list(): Namespace[] | Promise<Namespace[]>;
|
|
50
|
-
create(input: NamespaceCreateInput): Namespace | Promise<Namespace>;
|
|
51
|
-
update(id: string, input: NamespaceUpdateInput): Namespace | Promise<Namespace>;
|
|
52
|
-
remove(id: string): void | Promise<void>;
|
|
53
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from 'bun:test';
|
|
2
|
-
import { DisposeRegistry } from './DisposeRegistry';
|
|
3
|
-
|
|
4
|
-
describe('DisposeRegistry', () => {
|
|
5
|
-
test('runs cleanups in reverse (LIFO) order and clears the list', () => {
|
|
6
|
-
const registry = new DisposeRegistry();
|
|
7
|
-
const order: number[] = [];
|
|
8
|
-
registry.add(() => order.push(1));
|
|
9
|
-
registry.add(() => order.push(2));
|
|
10
|
-
registry.add(() => order.push(3));
|
|
11
|
-
|
|
12
|
-
expect(registry.size).toBe(3);
|
|
13
|
-
registry.disposeAll();
|
|
14
|
-
|
|
15
|
-
expect(order).toEqual([3, 2, 1]);
|
|
16
|
-
expect(registry.size).toBe(0);
|
|
17
|
-
expect(registry.isDisposed).toBe(true);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
test('a throwing cleanup does not strand the others', () => {
|
|
21
|
-
const registry = new DisposeRegistry();
|
|
22
|
-
const ran: string[] = [];
|
|
23
|
-
registry.add(() => ran.push('a'));
|
|
24
|
-
registry.add(() => {
|
|
25
|
-
throw new Error('boom');
|
|
26
|
-
});
|
|
27
|
-
registry.add(() => ran.push('c'));
|
|
28
|
-
|
|
29
|
-
expect(() => registry.disposeAll()).not.toThrow();
|
|
30
|
-
// 'c' (last added) runs first, then the thrower is swallowed, then 'a'.
|
|
31
|
-
expect(ran).toEqual(['c', 'a']);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
test('disposeAll is idempotent', () => {
|
|
35
|
-
const registry = new DisposeRegistry();
|
|
36
|
-
let count = 0;
|
|
37
|
-
registry.add(() => count++);
|
|
38
|
-
registry.disposeAll();
|
|
39
|
-
registry.disposeAll();
|
|
40
|
-
expect(count).toBe(1);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
test('adding after disposal runs the cleanup immediately (no leak)', () => {
|
|
44
|
-
const registry = new DisposeRegistry();
|
|
45
|
-
registry.disposeAll();
|
|
46
|
-
let ran = false;
|
|
47
|
-
registry.add(() => {
|
|
48
|
-
ran = true;
|
|
49
|
-
});
|
|
50
|
-
expect(ran).toBe(true);
|
|
51
|
-
expect(registry.size).toBe(0);
|
|
52
|
-
});
|
|
53
|
-
});
|