Browse Source

Extract BinaryDataCanvas

Define BinaryDataCanvas as own component.
pull/1/head
TheoryOfNekomata 1 year ago
parent
commit
af2ccbd7d8
31 changed files with 388 additions and 110 deletions
  1. +1
    -3
      categories/choice/react/package.json
  2. +1
    -5
      categories/multichoice/react/package.json
  3. +1
    -3
      categories/number/react/package.json
  4. +1
    -1
      packages/audio-utils/package.json
  5. +1
    -1
      packages/image-utils/package.json
  6. +9
    -0
      packages/react-binary-data-canvas/.eslintrc
  7. +107
    -0
      packages/react-binary-data-canvas/.gitignore
  8. +7
    -0
      packages/react-binary-data-canvas/LICENSE
  9. +77
    -0
      packages/react-binary-data-canvas/package.json
  10. +3
    -0
      packages/react-binary-data-canvas/pridepack.json
  11. +47
    -24
      packages/react-binary-data-canvas/src/BinaryDataCanvas.tsx
  12. +1
    -0
      packages/react-binary-data-canvas/src/index.ts
  13. +21
    -0
      packages/react-binary-data-canvas/tsconfig.eslint.json
  14. +21
    -0
      packages/react-binary-data-canvas/tsconfig.json
  15. +8
    -0
      packages/react-binary-data-canvas/vitest.config.ts
  16. +1
    -1
      packages/text-utils/package.json
  17. +1
    -1
      packages/video-utils/package.json
  18. +5
    -4
      packages/web-kitchensink-reactnext/package.json
  19. +2
    -2
      packages/web-kitchensink-reactnext/src/categories/blob/react/components/AudioFilePreview/index.tsx
  20. +2
    -2
      packages/web-kitchensink-reactnext/src/categories/blob/react/components/AudioMiniFilePreview/index.tsx
  21. +2
    -2
      packages/web-kitchensink-reactnext/src/categories/blob/react/components/BinaryFilePreview/index.tsx
  22. +1
    -2
      packages/web-kitchensink-reactnext/src/categories/blob/react/components/FileSelectBox/index.tsx
  23. +1
    -1
      packages/web-kitchensink-reactnext/src/categories/blob/react/components/ImageFilePreview/index.tsx
  24. +2
    -2
      packages/web-kitchensink-reactnext/src/categories/blob/react/components/TextFilePreview/index.tsx
  25. +1
    -1
      packages/web-kitchensink-reactnext/src/categories/blob/react/components/VideoFilePreview/index.tsx
  26. +0
    -20
      packages/web-kitchensink-reactnext/src/packages/react-binary-data-canvas/style.module.css
  27. +0
    -18
      packages/web-kitchensink-reactnext/src/packages/react-utils/index.ts
  28. +4
    -4
      packages/web-kitchensink-reactnext/src/pages/examples/blog-post/index.tsx
  29. +4
    -4
      packages/web-kitchensink-reactnext/src/utils/blob.ts
  30. +1
    -2
      packages/web-kitchensink-reactnext/tsconfig.json
  31. +55
    -7
      pnpm-lock.yaml

+ 1
- 3
categories/choice/react/package.json View File

@@ -74,9 +74,7 @@
"require": "./dist/cjs/production/index.js", "require": "./dist/cjs/production/index.js",
"import": "./dist/esm/production/index.js", "import": "./dist/esm/production/index.js",
"types": "./dist/types/index.d.ts" "types": "./dist/types/index.d.ts"
},
"./dist/RadioButton.css": "./dist/RadioButton.css",
"./dist/RadioTickBox.css": "./dist/RadioTickBox.css"
}
}, },
"typesVersions": { "typesVersions": {
"*": {} "*": {}


+ 1
- 5
categories/multichoice/react/package.json View File

@@ -76,11 +76,7 @@
"require": "./dist/cjs/production/index.js", "require": "./dist/cjs/production/index.js",
"import": "./dist/esm/production/index.js", "import": "./dist/esm/production/index.js",
"types": "./dist/types/index.d.ts" "types": "./dist/types/index.d.ts"
},
"./dist/TagInput.css": "./dist/TagInput.css",
"./dist/ToggleButton.css": "./dist/ToggleButton.css",
"./dist/ToggleSwitch.css": "./dist/ToggleSwitch.css",
"./dist/ToggleTickBox.css": "./dist/ToggleTickBox.css"
}
}, },
"typesVersions": { "typesVersions": {
"*": {} "*": {}


+ 1
- 3
categories/number/react/package.json View File

@@ -74,9 +74,7 @@
"require": "./dist/cjs/production/index.js", "require": "./dist/cjs/production/index.js",
"import": "./dist/esm/production/index.js", "import": "./dist/esm/production/index.js",
"types": "./dist/types/index.d.ts" "types": "./dist/types/index.d.ts"
},
"./dist/Slider.css": "./dist/Slider.css",
"./dist/Spinner.css": "./dist/Spinner.css"
}
}, },
"typesVersions": { "typesVersions": {
"*": {} "*": {}


+ 1
- 1
packages/audio-utils/package.json View File

@@ -1,5 +1,5 @@
{ {
"name": "@modal-soft/audio-utils",
"name": "@modal-sh/audio-utils",
"version": "0.0.0", "version": "0.0.0",
"files": [ "files": [
"dist", "dist",


+ 1
- 1
packages/image-utils/package.json View File

@@ -1,5 +1,5 @@
{ {
"name": "@modal-soft/image-utils",
"name": "@modal-sh/image-utils",
"version": "0.0.0", "version": "0.0.0",
"files": [ "files": [
"dist", "dist",


+ 9
- 0
packages/react-binary-data-canvas/.eslintrc View File

@@ -0,0 +1,9 @@
{
"root": true,
"extends": [
"lxsmnsyc/typescript/react"
],
"parserOptions": {
"project": "./tsconfig.eslint.json"
}
}

+ 107
- 0
packages/react-binary-data-canvas/.gitignore View File

@@ -0,0 +1,107 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.production
.env.development

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

.npmrc

+ 7
- 0
packages/react-binary-data-canvas/LICENSE View File

@@ -0,0 +1,7 @@
MIT License Copyright (c) 2023 TheoryOfNekomata <allan.crisostomo@outlook.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 77
- 0
packages/react-binary-data-canvas/package.json View File

@@ -0,0 +1,77 @@
{
"name": "@modal-sh/react-binary-data-canvas",
"version": "0.0.0",
"files": [
"dist",
"src"
],
"engines": {
"node": ">=12"
},
"license": "MIT",
"keywords": [
"pridepack"
],
"devDependencies": {
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@types/node": "^18.14.1",
"@types/react": "^18.0.27",
"eslint": "^8.35.0",
"eslint-config-lxsmnsyc": "^0.5.0",
"jsdom": "^21.1.0",
"pridepack": "2.4.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-test-renderer": "^18.2.0",
"tslib": "^2.5.0",
"typescript": "^4.9.5",
"vitest": "^0.28.1"
},
"peerDependencies": {
"react": "^16.8 || ^17.0 || ^18.0",
"react-dom": "^16.8 || ^17.0 || ^18.0"
},
"scripts": {
"prepublishOnly": "pridepack clean && pridepack build",
"build": "pridepack build",
"type-check": "pridepack check",
"lint": "pridepack lint",
"clean": "pridepack clean",
"watch": "pridepack watch",
"start": "pridepack start",
"dev": "pridepack dev",
"test": "vitest"
},
"private": false,
"description": "Displays binary data into a grid of bytes.",
"repository": {
"url": "",
"type": "git"
},
"homepage": "",
"bugs": {
"url": ""
},
"author": "TheoryOfNekomata <allan.crisostomo@outlook.com>",
"publishConfig": {
"access": "public"
},
"types": "./dist/types/index.d.ts",
"main": "./dist/cjs/production/index.js",
"module": "./dist/esm/production/index.js",
"exports": {
".": {
"development": {
"require": "./dist/cjs/development/index.js",
"import": "./dist/esm/development/index.js"
},
"require": "./dist/cjs/production/index.js",
"import": "./dist/esm/production/index.js",
"types": "./dist/types/index.d.ts"
}
},
"typesVersions": {
"*": {}
}
}

+ 3
- 0
packages/react-binary-data-canvas/pridepack.json View File

@@ -0,0 +1,3 @@
{
"target": "es2018"
}

packages/web-kitchensink-reactnext/src/packages/react-binary-data-canvas/index.tsx → packages/react-binary-data-canvas/src/BinaryDataCanvas.tsx View File

@@ -1,5 +1,4 @@
import * as React from 'react'; import * as React from 'react';
import styles from './style.module.css';


export type BinaryDataCanvasDerivedElement = HTMLDivElement; export type BinaryDataCanvasDerivedElement = HTMLDivElement;


@@ -21,36 +20,50 @@ export const BinaryDataCanvas = React.forwardRef<BinaryDataCanvasDerivedElement,
style, style,
...etcProps ...etcProps
}, forwardedRef) => { }, forwardedRef) => {
const bytesGrouped = arrayBuffer ? (Array.from(new Uint8Array(arrayBuffer)).slice(0, BYTES_PER_LINE * 20) as number[])
.reduce(
(byteArray: number[][], byte: number, i) => {
if (i % BYTES_PER_LINE === 0) {
return [
...byteArray,
[byte],
]
}
const bytesGrouped = arrayBuffer
? (Array.from(new Uint8Array(arrayBuffer)).slice(0, BYTES_PER_LINE * 20) as number[])
.reduce(
(byteArray: number[][], byte: number, i) => {
if (i % BYTES_PER_LINE === 0) {
return [
...byteArray,
[byte],
];
}


const lastLine = byteArray.at(-1) as number[]
const lastLine = byteArray.at(-1) as number[];


return [
...(byteArray.slice(0, -1)),
[...lastLine, byte],
]
},
[] as number[][],
) : [] as number[][];
return [
...(byteArray.slice(0, -1)),
[...lastLine, byte],
];
},
[] as number[][],
)
: [] as number[][];


return ( return (
<div <div
{...etcProps} {...etcProps}
className={`${styles['react-binary-data-canvas']} ${className ?? ''}`.trim()}
style={style}
className={`react-binary-data-canvas ${className ?? ''}`.trim()}
style={{
...style,
display: 'flex',
alignItems: 'flex-start',
}}
ref={forwardedRef} ref={forwardedRef}
> >
{headers && ( {headers && (
<pre <pre
className={styles['line-numbers']}
className="line-numbers"
style={{
overflow: 'visible',
padding: 0,
margin: 0,
lineHeight: 1.2,
textAlign: 'right',
userSelect: 'none',
}}
> >
<code> <code>
{'\u00a0'} {'\u00a0'}
@@ -59,7 +72,10 @@ export const BinaryDataCanvas = React.forwardRef<BinaryDataCanvasDerivedElement,
<React.Fragment key={i}> <React.Fragment key={i}>
{'\n'} {'\n'}
<code <code
className={styles['code']}
className="code"
style={{
whiteSpace: 'nowrap',
}}
> >
0x{(BYTES_PER_LINE * i).toString(16).padStart(2, '0')} 0x{(BYTES_PER_LINE * i).toString(16).padStart(2, '0')}
</code> </code>
@@ -69,7 +85,14 @@ export const BinaryDataCanvas = React.forwardRef<BinaryDataCanvasDerivedElement,
</pre> </pre>
)} )}
<div className="highlight"> <div className="highlight">
<pre>
<pre
style={{
overflow: 'visible',
padding: 0,
margin: 0,
lineHeight: 1.2,
}}
>
<code> <code>
{headers && new Array(BYTES_PER_LINE).fill(0).map((_, i) => ( {headers && new Array(BYTES_PER_LINE).fill(0).map((_, i) => (
<span <span
@@ -104,7 +127,7 @@ export const BinaryDataCanvas = React.forwardRef<BinaryDataCanvasDerivedElement,
</pre> </pre>
</div> </div>
</div> </div>
)
);
}); });


BinaryDataCanvas.displayName = 'BinaryDataCanvas'; BinaryDataCanvas.displayName = 'BinaryDataCanvas';

+ 1
- 0
packages/react-binary-data-canvas/src/index.ts View File

@@ -0,0 +1 @@
export * from './BinaryDataCanvas';

+ 21
- 0
packages/react-binary-data-canvas/tsconfig.eslint.json View File

@@ -0,0 +1,21 @@
{
"exclude": ["node_modules"],
"include": ["src", "types", "test"],
"compilerOptions": {
"module": "ESNext",
"lib": ["DOM", "ESNext"],
"importHelpers": true,
"declaration": true,
"sourceMap": true,
"rootDir": "./",
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"moduleResolution": "node",
"jsx": "react",
"esModuleInterop": true,
"target": "es2018"
}
}

+ 21
- 0
packages/react-binary-data-canvas/tsconfig.json View File

@@ -0,0 +1,21 @@
{
"exclude": ["node_modules"],
"include": ["src", "types"],
"compilerOptions": {
"module": "ESNext",
"lib": ["DOM", "ESNext"],
"importHelpers": true,
"declaration": true,
"sourceMap": true,
"rootDir": "./src",
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"moduleResolution": "node",
"jsx": "react",
"esModuleInterop": true,
"target": "es2018"
}
}

+ 8
- 0
packages/react-binary-data-canvas/vitest.config.ts View File

@@ -0,0 +1,8 @@
/// <reference types="vitest" />

export default ({
test: {
global: true,
environment: 'jsdom',
},
});

+ 1
- 1
packages/text-utils/package.json View File

@@ -1,5 +1,5 @@
{ {
"name": "@modal-soft/text-utils",
"name": "@modal-sh/text-utils",
"version": "0.0.0", "version": "0.0.0",
"files": [ "files": [
"dist", "dist",


+ 1
- 1
packages/video-utils/package.json View File

@@ -1,5 +1,5 @@
{ {
"name": "@modal-soft/video-utils",
"name": "@modal-sh/video-utils",
"version": "0.0.0", "version": "0.0.0",
"files": [ "files": [
"dist", "dist",


+ 5
- 4
packages/web-kitchensink-reactnext/package.json View File

@@ -30,11 +30,12 @@
"tailwindcss": "3.3.2", "tailwindcss": "3.3.2",
"typescript": "5.1.3", "typescript": "5.1.3",
"wavesurfer.js": "7.0.0-beta.11", "wavesurfer.js": "7.0.0-beta.11",
"@modal-soft/audio-utils": "workspace:*",
"@modal-soft/image-utils": "workspace:*",
"@modal-soft/text-utils": "workspace:*",
"@modal-soft/video-utils": "workspace:*",
"@modal-sh/audio-utils": "workspace:*",
"@modal-sh/image-utils": "workspace:*",
"@modal-sh/text-utils": "workspace:*",
"@modal-sh/video-utils": "workspace:*",
"@modal-sh/react-utils": "workspace:*", "@modal-sh/react-utils": "workspace:*",
"@modal-sh/react-binary-data-canvas": "workspace:*",
"@tesseract-design/web-base": "workspace:*", "@tesseract-design/web-base": "workspace:*",
"@tesseract-design/web-action-react": "workspace:*", "@tesseract-design/web-action-react": "workspace:*",
"@tesseract-design/web-color-react": "workspace:*", "@tesseract-design/web-color-react": "workspace:*",


+ 2
- 2
packages/web-kitchensink-reactnext/src/categories/blob/react/components/AudioFilePreview/index.tsx View File

@@ -11,10 +11,10 @@ import {useMediaControls} from '../../hooks/interactive';
import {useFileMetadata, useFileUrl} from '@/categories/blob/react'; import {useFileMetadata, useFileUrl} from '@/categories/blob/react';


import clsx from 'clsx'; import clsx from 'clsx';
import {SpectrogramCanvas, WaveformCanvas} from '@modal-soft/react-wavesurfer';
import {SpectrogramCanvas, WaveformCanvas} from '@modal-sh/react-wavesurfer';
import {Slider} from '@tesseract-design/web-number-react'; import {Slider} from '@tesseract-design/web-number-react';
import {KeyValueTable} from '@tesseract-design/web-information-react'; import {KeyValueTable} from '@tesseract-design/web-information-react';
import {useClientSide} from '@modal-soft/react-utils';
import {useClientSide} from '@modal-sh/react-utils';
import {CommonPreviewProps} from '@/categories/blob/react/common'; import {CommonPreviewProps} from '@/categories/blob/react/common';


export type AudioFilePreviewDerivedElement = HTMLAudioElement; export type AudioFilePreviewDerivedElement = HTMLAudioElement;


+ 2
- 2
packages/web-kitchensink-reactnext/src/categories/blob/react/components/AudioMiniFilePreview/index.tsx View File

@@ -4,8 +4,8 @@ import theme from '@/styles/theme';
import {useMediaControls} from '../../hooks/interactive'; import {useMediaControls} from '../../hooks/interactive';
import {useFileMetadata, useFileUrl} from '@/categories/blob/react'; import {useFileMetadata, useFileUrl} from '@/categories/blob/react';
import clsx from 'clsx'; import clsx from 'clsx';
import {SpectrogramCanvas, WaveformCanvas} from '@modal-soft/react-wavesurfer';
import {useClientSide} from '@modal-soft/react-utils';
import {SpectrogramCanvas, WaveformCanvas} from '@modal-sh/react-wavesurfer';
import {useClientSide} from '@modal-sh/react-utils';


export type AudioMiniFilePreviewDerivedElement = HTMLAudioElement; export type AudioMiniFilePreviewDerivedElement = HTMLAudioElement;




+ 2
- 2
packages/web-kitchensink-reactnext/src/categories/blob/react/components/BinaryFilePreview/index.tsx View File

@@ -4,8 +4,8 @@ import {formatFileSize, formatNumeral} from '@/utils/numeral';
import {useFileMetadata, useFileUrl} from '@/categories/blob/react'; import {useFileMetadata, useFileUrl} from '@/categories/blob/react';
import clsx from 'clsx'; import clsx from 'clsx';
import {KeyValueTable} from '@tesseract-design/web-information-react'; import {KeyValueTable} from '@tesseract-design/web-information-react';
import {BinaryDataCanvas} from '@modal-soft/react-binary-data-canvas';
import {useClientSide} from '@modal-soft/react-utils';
import {BinaryDataCanvas} from '@modal-sh/react-binary-data-canvas';
import {useClientSide} from '@modal-sh/react-utils';
import {CommonPreviewProps} from '@/categories/blob/react/common'; import {CommonPreviewProps} from '@/categories/blob/react/common';


export type BinaryFilePreviewDerivedElement = HTMLDivElement; export type BinaryFilePreviewDerivedElement = HTMLDivElement;


+ 1
- 2
packages/web-kitchensink-reactnext/src/categories/blob/react/components/FileSelectBox/index.tsx View File

@@ -7,9 +7,8 @@ import {ImageFilePreview} from '../ImageFilePreview';
import {VideoFilePreview} from '../VideoFilePreview'; import {VideoFilePreview} from '../VideoFilePreview';
import {TextFilePreview} from '../TextFilePreview'; import {TextFilePreview} from '../TextFilePreview';
import {AudioMiniFilePreview} from '../AudioMiniFilePreview'; import {AudioMiniFilePreview} from '../AudioMiniFilePreview';
import {delegateTriggerEvent} from '@modal-sh/react-utils';
import {delegateTriggerEvent, useClientSide} from '@modal-sh/react-utils';
import clsx from 'clsx'; import clsx from 'clsx';
import {useClientSide} from '@modal-soft/react-utils';
import {FilePreviewComponent} from '@/categories/blob/react/common'; import {FilePreviewComponent} from '@/categories/blob/react/common';


const FILE_PREVIEW_COMPONENTS: Record<ContentType, FilePreviewComponent> = { const FILE_PREVIEW_COMPONENTS: Record<ContentType, FilePreviewComponent> = {


+ 1
- 1
packages/web-kitchensink-reactnext/src/categories/blob/react/components/ImageFilePreview/index.tsx View File

@@ -4,7 +4,7 @@ import {formatFileSize, formatNumeral} from '@/utils/numeral';
import clsx from 'clsx'; import clsx from 'clsx';
import {useFileMetadata, useFileUrl, useImageControls} from '@/categories/blob/react'; import {useFileMetadata, useFileUrl, useImageControls} from '@/categories/blob/react';
import {KeyValueTable} from '@tesseract-design/web-information-react'; import {KeyValueTable} from '@tesseract-design/web-information-react';
import {useClientSide} from '@modal-soft/react-utils';
import {useClientSide} from '@modal-sh/react-utils';
import {CommonPreviewProps} from '@/categories/blob/react/common'; import {CommonPreviewProps} from '@/categories/blob/react/common';
import {Swatch} from '@tesseract-design/web-color-react'; import {Swatch} from '@tesseract-design/web-color-react';




+ 2
- 2
packages/web-kitchensink-reactnext/src/categories/blob/react/components/TextFilePreview/index.tsx View File

@@ -4,8 +4,8 @@ import {useFileMetadata, useFileUrl} from '@/categories/blob/react';
import {augmentTextFile, getMimeTypeDescription} from '@/utils/blob'; import {augmentTextFile, getMimeTypeDescription} from '@/utils/blob';
import clsx from 'clsx'; import clsx from 'clsx';
import {KeyValueTable} from '@tesseract-design/web-information-react'; import {KeyValueTable} from '@tesseract-design/web-information-react';
import {Refractor} from '@modal-soft/react-refractor';
import {useClientSide} from '@modal-soft/react-utils';
import {Refractor} from '@modal-sh/react-refractor';
import {useClientSide} from '@modal-sh/react-utils';
import {CommonPreviewProps} from '@/categories/blob/react/common'; import {CommonPreviewProps} from '@/categories/blob/react/common';


type TextFilePreviewDerivedComponent = HTMLDivElement; type TextFilePreviewDerivedComponent = HTMLDivElement;


+ 1
- 1
packages/web-kitchensink-reactnext/src/categories/blob/react/components/VideoFilePreview/index.tsx View File

@@ -5,7 +5,7 @@ import {useFileMetadata, useFileUrl, useMediaControls} from '@tesseract-design/w
import clsx from 'clsx'; import clsx from 'clsx';
import {Slider} from '@tesseract-design/web-number-react'; import {Slider} from '@tesseract-design/web-number-react';
import {KeyValueTable} from '@tesseract-design/web-information-react'; import {KeyValueTable} from '@tesseract-design/web-information-react';
import {useClientSide} from '@modal-soft/react-utils';
import {useClientSide} from '@modal-sh/react-utils';
import {CommonPreviewProps} from '@/categories/blob/react/common'; import {CommonPreviewProps} from '@/categories/blob/react/common';


export type VideoFilePreviewDerivedComponent = HTMLVideoElement; export type VideoFilePreviewDerivedComponent = HTMLVideoElement;


+ 0
- 20
packages/web-kitchensink-reactnext/src/packages/react-binary-data-canvas/style.module.css View File

@@ -1,20 +0,0 @@
.react-binary-data-canvas {
display: flex;
align-items: flex-start;
}

.react-binary-data-canvas pre {
overflow: visible;
padding: 0;
margin: 0;
line-height: 1.2;
}

.line-numbers {
text-align: right;
user-select: none;
}

.code {
white-space: nowrap;
}

+ 0
- 18
packages/web-kitchensink-reactnext/src/packages/react-utils/index.ts View File

@@ -1,18 +0,0 @@
import * as React from 'react';

export interface UseEnhancedOptions {
clientSide: boolean;
initial?: boolean;
}

export const useClientSide = (options: UseEnhancedOptions) => {
const { clientSide: enhancedProp, initial = false } = options;
const [enhanced, setEnhanced] = React.useState(initial);
React.useEffect(() => {
setEnhanced(enhancedProp);
}, [enhancedProp]);

return React.useMemo(() => ({
clientSide: enhanced,
}), [enhanced]);
};

+ 4
- 4
packages/web-kitchensink-reactnext/src/pages/examples/blog-post/index.tsx View File

@@ -1,4 +1,4 @@
import {Refractor} from '@modal-soft/react-refractor';
import {Refractor} from '@modal-sh/react-refractor';
import {NextPage} from 'next'; import {NextPage} from 'next';
import * as React from 'react'; import * as React from 'react';
import {getFormValues} from '@theoryofnekomata/formxtra'; import {getFormValues} from '@theoryofnekomata/formxtra';
@@ -25,7 +25,7 @@ const BlogPostPage: NextPage = () => {
Using Refractor on your Next website Using Refractor on your Next website
</h1> </h1>
<p> <p>
Use <code>@modal-soft/react-refractor</code> as follows on your page:
Use <code>@modal-sh/react-refractor</code> as follows on your page:
</p> </p>
</div> </div>
<div className="bg-shade/20 overflow-auto pt-4 pb-8 text-sm"> <div className="bg-shade/20 overflow-auto pt-4 pb-8 text-sm">
@@ -38,7 +38,7 @@ const BlogPostPage: NextPage = () => {
actions={ actions={
<></> <></>
} }
code={`import {Refractor} from '@modal-soft/react-refractor';
code={`import {Refractor} from '@modal-sh/react-refractor';
import {NextPage} from 'next'; import {NextPage} from 'next';


const BlogPostPage: NextPage = () => { const BlogPostPage: NextPage = () => {
@@ -47,7 +47,7 @@ const BlogPostPage: NextPage = () => {
<Refractor <Refractor
language="tsx" language="tsx"
code={\` code={\`
import {Refractor} from '@modal-soft/react-refractor';
import {Refractor} from '@modal-sh/react-refractor';
\`} \`}
/> />
</div> </div>


+ 4
- 4
packages/web-kitchensink-reactnext/src/utils/blob.ts View File

@@ -1,8 +1,8 @@
import * as mimeTypes from 'mime-types'; import * as mimeTypes from 'mime-types';
import {getTextMetadata, TextMetadata} from '@modal-soft/text-utils';
import {getMetadataFromUrl as getImageMetadataFromUrl, ImageMetadata} from '@modal-soft/image-utils';
import {getMetadataFromUrl as getAudioMetadataFromUrl, AudioMetadata} from '@modal-soft/audio-utils';
import {getMetadataFromUrl as getVideoMetadataFromUrl, VideoMetadata} from '@modal-soft/video-utils';
import {getTextMetadata, TextMetadata} from '@modal-sh/text-utils';
import {getMetadataFromUrl as getImageMetadataFromUrl, ImageMetadata} from '@modal-sh/image-utils';
import {getMetadataFromUrl as getAudioMetadataFromUrl, AudioMetadata} from '@modal-sh/audio-utils';
import {getMetadataFromUrl as getVideoMetadataFromUrl, VideoMetadata} from '@modal-sh/video-utils';


const MIME_TYPE_DESCRIPTIONS = { const MIME_TYPE_DESCRIPTIONS = {
'image/gif': 'GIF Image', 'image/gif': 'GIF Image',


+ 1
- 2
packages/web-kitchensink-reactnext/tsconfig.json View File

@@ -18,8 +18,7 @@
"@/*": ["./src/*"], "@/*": ["./src/*"],
"tailwind.config": ["./tailwind.config.js"], "tailwind.config": ["./tailwind.config.js"],
"@tesseract-design/web-blob-react": ["./src/categories/blob/react"], "@tesseract-design/web-blob-react": ["./src/categories/blob/react"],
"@tesseract-design/web-number-react": ["./src/categories/number/react"],
"@modal-soft/*": ["./src/packages/*"],
"@modal-sh/*": ["./src/packages/*"],
} }
}, },
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],


+ 55
- 7
pnpm-lock.yaml View File

@@ -572,6 +572,51 @@ importers:
specifier: ^0.28.1 specifier: ^0.28.1
version: 0.28.1(jsdom@21.1.0) version: 0.28.1(jsdom@21.1.0)


packages/react-binary-data-canvas:
devDependencies:
'@testing-library/jest-dom':
specifier: ^5.16.5
version: 5.16.5
'@testing-library/react':
specifier: ^13.4.0
version: 13.4.0(react-dom@18.2.0)(react@18.2.0)
'@types/node':
specifier: ^18.14.1
version: 18.14.1
'@types/react':
specifier: ^18.0.27
version: 18.2.14
eslint:
specifier: ^8.35.0
version: 8.43.0
eslint-config-lxsmnsyc:
specifier: ^0.5.0
version: 0.5.0(eslint@8.43.0)(typescript@4.9.5)
jsdom:
specifier: ^21.1.0
version: 21.1.0
pridepack:
specifier: 2.4.4
version: 2.4.4(eslint@8.43.0)(tslib@2.6.0)(typescript@4.9.5)
react:
specifier: ^18.2.0
version: 18.2.0
react-dom:
specifier: ^18.2.0
version: 18.2.0(react@18.2.0)
react-test-renderer:
specifier: ^18.2.0
version: 18.2.0(react@18.2.0)
tslib:
specifier: ^2.5.0
version: 2.6.0
typescript:
specifier: ^4.9.5
version: 4.9.5
vitest:
specifier: ^0.28.1
version: 0.28.1(jsdom@21.1.0)

packages/react-utils: packages/react-utils:
devDependencies: devDependencies:
'@testing-library/jest-dom': '@testing-library/jest-dom':
@@ -677,19 +722,22 @@ importers:


packages/web-kitchensink-reactnext: packages/web-kitchensink-reactnext:
dependencies: dependencies:
'@modal-sh/react-utils':
specifier: workspace:*
version: link:../react-utils
'@modal-soft/audio-utils':
'@modal-sh/audio-utils':
specifier: workspace:* specifier: workspace:*
version: link:../audio-utils version: link:../audio-utils
'@modal-soft/image-utils':
'@modal-sh/image-utils':
specifier: workspace:* specifier: workspace:*
version: link:../image-utils version: link:../image-utils
'@modal-soft/text-utils':
'@modal-sh/react-binary-data-canvas':
specifier: workspace:*
version: link:../react-binary-data-canvas
'@modal-sh/react-utils':
specifier: workspace:*
version: link:../react-utils
'@modal-sh/text-utils':
specifier: workspace:* specifier: workspace:*
version: link:../text-utils version: link:../text-utils
'@modal-soft/video-utils':
'@modal-sh/video-utils':
specifier: workspace:* specifier: workspace:*
version: link:../video-utils version: link:../video-utils
'@tesseract-design/web-action-react': '@tesseract-design/web-action-react':


Loading…
Cancel
Save