index
int64
0
0
repo_id
stringlengths
16
181
file_path
stringlengths
28
270
content
stringlengths
1
11.6M
__index_level_0__
int64
0
10k
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema/demos/3d
petrpan-code/sanity-io/sanity/dev/test-studio/schema/demos/3d/torus-knot/TorusKnotPreview.tsx
import {Canvas, Vector3} from '@react-three/fiber' import React, {memo, startTransition, Suspense, useEffect, useRef, useState} from 'react' import styled from 'styled-components' import {Box} from '@sanity/ui' import View from './TorusKnotScene' import {useLazyFrameloop} from './useLazyFrameLoop' const Container = s...
1,400
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema/demos/3d
petrpan-code/sanity-io/sanity/dev/test-studio/schema/demos/3d/torus-knot/TorusKnotScene.tsx
/* eslint-disable no-multi-assign */ /* eslint-disable react/no-unknown-property */ // Fork of https://codesandbox.io/s/layer-materials-nvup4 import {Environment, OrbitControls} from '@react-three/drei' import {useFrame, useThree} from '@react-three/fiber' import {Color, Depth, Fresnel, LayerMaterial} from 'lamina' im...
1,401
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema/demos/3d
petrpan-code/sanity-io/sanity/dev/test-studio/schema/demos/3d/torus-knot/index.ts
export * from './schemaType'
1,402
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema/demos/3d
petrpan-code/sanity-io/sanity/dev/test-studio/schema/demos/3d/torus-knot/schemaType.tsx
import React from 'react' import {defineType} from 'sanity' import {structureGroupOptions} from '../../../../structure/groupByOption' import TorusKnotInput from './TorusKnotInput' import {LazyPreviewMedia, LazyColorInput} from './TorusKnotLazyComponents' const initialBase = '#ff4eb8' const initialColorA = '#00ffff' co...
1,403
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema/demos/3d
petrpan-code/sanity-io/sanity/dev/test-studio/schema/demos/3d/torus-knot/useLazyFrameLoop.ts
import {useEffect, useState, startTransition} from 'react' import {usePrefersReducedMotion} from '@sanity/ui' export function useLazyFrameloop(ref: React.RefObject<any>): 'always' | 'demand' | 'never' { const reduceMotion = usePrefersReducedMotion() const [frameloop, setFrameloop] = useState<'always' | 'never'>('n...
1,404
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema/docs
petrpan-code/sanity-io/sanity/dev/test-studio/schema/docs/v3/index.ts
import {example1SchemaType} from './example1' import {validationTest} from './async-functions/schemaType' import {formComponentsSchema} from './form-components-api' export const v3docs = { types: [example1SchemaType, validationTest, formComponentsSchema], }
1,405
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema/docs/v3
petrpan-code/sanity-io/sanity/dev/test-studio/schema/docs/v3/async-functions/schemaType.ts
import {ConfigContext, defineField, defineType} from 'sanity' import {structureGroupOptions} from '../../../../structure/groupByOption' export const validationTest = defineType({ type: 'document', name: 'v3-validation', title: 'v3 validation', options: structureGroupOptions({ structureGroup: 'v3', }), ...
1,406
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema/docs/v3
petrpan-code/sanity-io/sanity/dev/test-studio/schema/docs/v3/example1/CodeInput.tsx
import {FieldMember, MemberField, ObjectInputProps} from 'sanity' import {Stack} from '@sanity/ui' import React from 'react' export function CodeInput(props: ObjectInputProps) { const {members, renderField, renderItem} = props const codeMember = members.find((member) => member.kind === 'field' && member.name === ...
1,407
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema/docs/v3
petrpan-code/sanity-io/sanity/dev/test-studio/schema/docs/v3/example1/index.ts
export * from './schemaType'
1,408
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema/docs/v3
petrpan-code/sanity-io/sanity/dev/test-studio/schema/docs/v3/example1/schemaType.ts
import {structureGroupOptions} from '../../../../structure/groupByOption' import {CodeInput} from './CodeInput' export const example1SchemaType = { type: 'document', name: 'v3-example1', title: 'v3 example #1', options: structureGroupOptions({ structureGroup: 'v3', }), fields: [ { type: 'stri...
1,409
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema/docs/v3
petrpan-code/sanity-io/sanity/dev/test-studio/schema/docs/v3/form-components-api/components.tsx
import React, {useCallback} from 'react' import {hues} from '@sanity/color' import {Box, Stack, Heading, Flex, Inline, Text, Grid, Button} from '@sanity/ui' import { ArrayOfPrimitivesInputProps, ArraySchemaType, ArrayOfPrimitivesFunctions, FieldProps, ArrayInputFunctionsProps, InputProps, ItemProps, Pre...
1,410
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema/docs/v3
petrpan-code/sanity-io/sanity/dev/test-studio/schema/docs/v3/form-components-api/index.ts
export * from './schema'
1,411
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema/docs/v3
petrpan-code/sanity-io/sanity/dev/test-studio/schema/docs/v3/form-components-api/schema.tsx
import React from 'react' import {defineType} from 'sanity' import {structureGroupOptions} from '../../../../structure/groupByOption' import { FormInput, CustomField, CustomInput, CustomPreview, CustomItem, ArrayWithCustomActions, } from './components' export const formComponentsSchema = defineType({ typ...
1,412
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema
petrpan-code/sanity-io/sanity/dev/test-studio/schema/externalPlugins/markdown.ts
import {defineType} from 'sanity' export default defineType({ type: 'document', name: 'markdownTest', title: 'Markdown test', fields: [ { type: 'string', name: 'title', title: 'Title', }, // { // type: 'markdown', // name: 'markdown', // title: 'Markdown', //...
1,413
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema
petrpan-code/sanity-io/sanity/dev/test-studio/schema/externalPlugins/mux.ts
import {defineType} from 'sanity' export default defineType({ title: 'Mux video post', name: 'muxVideoPost', type: 'document', fields: [ {title: 'Title', name: 'title', type: 'string'}, {title: 'Video file', name: 'video', type: 'mux.video'}, ], })
1,414
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema
petrpan-code/sanity-io/sanity/dev/test-studio/schema/plugins/code.tsx
import {CodeBlockIcon} from '@sanity/icons' import {defineType} from 'sanity' export default defineType({ name: 'codeTest', type: 'document', title: 'Code test', icon: CodeBlockIcon, fields: [ { name: 'title', title: 'Title', type: 'string', }, { name: 'code', title:...
1,415
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema
petrpan-code/sanity-io/sanity/dev/test-studio/schema/plugins/color.tsx
/* eslint-disable react/display-name */ import {DropIcon} from '@sanity/icons' import React from 'react' import {defineType} from 'sanity' export default defineType({ name: 'colorTest', type: 'document', title: 'Color', icon: DropIcon, preview: { select: { title: 'title', color: 'testColor1'...
1,416
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema
petrpan-code/sanity-io/sanity/dev/test-studio/schema/plugins/geopoint.tsx
import {EarthGlobeIcon} from '@sanity/icons' import React from 'react' import {defineType} from 'sanity' // import config from 'config:@sanity/google-maps-input' export default defineType({ name: 'geopointTest', type: 'document', title: 'Geopoint test', icon: EarthGlobeIcon, fields: [ { name: 'titl...
1,417
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema
petrpan-code/sanity-io/sanity/dev/test-studio/schema/plugins/orderableCategory.ts
// import {orderRankField, orderRankOrdering} from '@sanity/orderable-document-list' // export const orderableCategoryDocumentType = { // type: 'document', // name: 'orderableCategory', // title: 'Orderable category', // orderings: [orderRankOrdering], // fields: [ // orderRankField({type: 'orderableCate...
1,418
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema
petrpan-code/sanity-io/sanity/dev/test-studio/schema/plugins/orderableTag.ts
// import {orderRankField, orderRankOrdering} from '@sanity/orderable-document-list' // export const orderableTagDocumentType = { // type: 'document', // name: 'orderableTag', // title: 'Orderable tag', // orderings: [orderRankOrdering], // fields: [ // orderRankField({type: 'orderableTag'}), // { //...
1,419
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/arrays.tsx
import React from 'react' import {ImageIcon, OlistIcon} from '@sanity/icons' import {defineField, defineType} from 'sanity' export const topLevelArrayType = defineType({ name: 'topLevelArrayType', type: 'array', of: [ { type: 'object', title: 'Content', fields: [ {name: 'textContent...
1,420
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/booleans.ts
import {CheckmarkCircleIcon} from '@sanity/icons' import {defineType} from 'sanity' export default defineType({ name: 'booleansTest', type: 'document', title: 'Booleans test', icon: CheckmarkCircleIcon, fieldsets: [ { name: 'collection', title: 'Collection of switches', description: 'Sh...
1,421
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/crossDatasetReference.ts
import {UserIcon, MoonIcon, BookIcon} from '@sanity/icons' import {defineType} from 'sanity' export const crossDatasetSubtype = defineType({ type: 'crossDatasetReference', name: 'crossDatasetSubtype', title: 'Subtype of cross dataset references', dataset: 'playground', to: [ { type: 'book', i...
1,422
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/date.ts
import {CalendarIcon} from '@sanity/icons' import {defineType} from 'sanity' export default defineType({ name: 'dateTest', type: 'document', title: 'Date test', icon: CalendarIcon, fields: [ { name: 'title', type: 'string', title: 'Title', }, { name: 'justDefaults', ...
1,423
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/datetime.ts
import {CalendarIcon} from '@sanity/icons' import {defineType} from 'sanity' export default defineType({ name: 'datetimeTest', type: 'document', title: 'Datetime test', icon: CalendarIcon, fields: [ { name: 'title', type: 'string', title: 'Title', }, { name: 'justDefaults'...
1,424
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/emails.ts
import {EnvelopeIcon} from '@sanity/icons' import {defineType} from 'sanity' export default defineType({ name: 'emailsTest', type: 'document', title: 'Emails test', icon: EnvelopeIcon, fields: [ { name: 'title', type: 'string', title: 'Title', }, { name: 'myUrlField', ...
1,425
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/files.ts
import {BinaryDocumentIcon} from '@sanity/icons' import {defineType} from 'sanity' export default defineType({ name: 'filesTest', type: 'document', title: 'Files test', icon: BinaryDocumentIcon, fields: [ { name: 'title', title: 'Title', type: 'string', }, { name: 'someFil...
1,426
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/images.ts
import {ImagesIcon} from '@sanity/icons' import {defineType} from 'sanity' // import petsAssetSource from '../../parts/assetSources/pets' // import noopAssetSource from '../../parts/assetSources/noop' export const myImage = defineType({ name: 'myImage', title: 'Some image type', type: 'image', fields: [ { ...
1,427
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/numbers.ts
// import {TiSortNumerically as icon} from 'react-icons/ti' import {defineType} from 'sanity' export default defineType({ name: 'numbersTest', type: 'document', title: 'Numbers test', // icon, preview: { select: { title: 'title', subtitle: 'myNumberField', }, }, fields: [ { ...
1,428
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/objects.tsx
/* eslint-disable func-name-matching */ // import {FaPuzzlePiece as icon} from 'react-icons/fa' import {defineType, FormPatch, set, TransformPatches} from 'sanity' import React, {useCallback} from 'react' export const myObject = defineType({ type: 'object', name: 'myObject', title: 'My object', // icon, // ...
1,429
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/references.ts
import {SyncIcon} from '@sanity/icons' import {defineField, defineType, type ReferenceFilterResolverContext} from 'sanity' export const referenceAlias = defineType({ type: 'reference', name: 'reference-alias', title: 'Reference alias', description: 'This is a reference alias type', to: {type: 'referenceTest'...
1,430
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/slugs.ts
import {defineField, defineType} from 'sanity' export const slugAlias = { name: 'slug-alias', type: 'slug', title: 'Slug alias', } export default defineType({ name: 'slugsTest', type: 'document', title: 'Slugs test', preview: { select: { title: 'title', subtitle: 'slug.current', }, ...
1,431
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/strings.tsx
import React from 'react' import {defineType} from 'sanity' import {HooksBasedStringInput} from './components/HooksBasedStringInput' export default defineType({ name: 'stringsTest', type: 'document', title: 'Strings test', fields: [ { name: 'title', type: 'string', title: 'Title', d...
1,432
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/texts.ts
// import {MdFormatAlignLeft as icon} from 'react-icons/md' import {defineType} from 'sanity' export default defineType({ name: 'textsTest', type: 'document', title: 'Texts tests', // icon, fields: [ { name: 'title', type: 'string', title: 'Title', description: "NOT a text field ...
1,433
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/urls.ts
import {LinkIcon} from '@sanity/icons' import {defineType} from 'sanity' export default defineType({ name: 'urlsTest', type: 'document', title: 'URLs test', icon: LinkIcon, fields: [ { name: 'title', type: 'string', title: 'Title', }, { name: 'myUrlField', type: 'url...
1,434
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/components/HooksBasedStringInput.tsx
import {Inline, Text} from '@sanity/ui' import React from 'react' import {StringInputProps, set} from 'sanity' export const HooksBasedStringInput = React.forwardRef<any, StringInputProps>((props, ref) => { const {value, schemaType, onChange} = props const [isEditing, setIsEditing] = React.useState(false) return...
1,435
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/portableText/InfoBoxPreview.tsx
import {InfoOutlineIcon} from '@sanity/icons' import {Box, Flex, Text} from '@sanity/ui' import React from 'react' interface InfoBoxPreviewProps { value?: {_type: 'infobox'; body: unknown[]; title: string} } export function InfoBoxPreview(props: InfoBoxPreviewProps) { const {value} = props const {body, title} =...
1,436
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/portableText/LinkAnnotationInput.tsx
import {isPlainObject} from 'lodash' import React, {useCallback, useMemo} from 'react' import {FormPatch, PatchEvent, ValidationMarker, set, setIfMissing, useClient} from 'sanity' import {Box} from '@sanity/ui' import * as PathUtils from '@sanity/util/paths' export function isRecord(value: unknown): value is Record<st...
1,437
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/portableText/allTheBellsAndWhistles.ts
import {BellIcon, ImageIcon, InfoOutlineIcon} from '@sanity/icons' import {Rule} from '@sanity/types' import {defineArrayMember, defineField, defineType} from 'sanity' import {InfoBoxPreview} from './InfoBoxPreview' import {LinkAnnotationInput} from './LinkAnnotationInput' export const ptAllTheBellsAndWhistlesType = d...
1,438
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/portableText/blocks.tsx
import {ComposeIcon, DropIcon, ImageIcon} from '@sanity/icons' import React from 'react' import { BlockEditor, PortableTextInputProps, defineArrayMember, defineField, defineType, } from 'sanity' function CustomEditor(props: PortableTextInputProps) { const {markers, value} = props const newMarkers = marke...
1,439
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/portableText/manyEditors.js
import {defineArrayMember, defineField, defineType} from '@sanity/types' import {CalloutPreview} from './components/CalloutPreview' function extractTextFromBlocks(blocks) { if (!blocks) { return '' } return blocks .map((block) => { return block.children .filter((child) => child._type === 's...
1,440
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/portableText/richTextObject.ts
export default { title: 'Rich Text', name: 'richTextObject', type: 'object', fields: [ { title: 'Text', name: 'text', type: 'array', of: [{type: 'block'}, {type: 'button'}], }, ], }
1,441
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/portableText/simpleBlock.tsx
import React from 'react' import {defineArrayMember, defineType} from 'sanity' import {toPlainText} from '@portabletext/react' import {CalloutPreview} from './components/CalloutPreview' const linkType = defineArrayMember({ type: 'object', name: 'link', fields: [ { type: 'string', name: 'href', ...
1,442
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/portableText/simpleBlockNote.ts
import {defineField, defineType} from 'sanity' export default defineType({ name: 'simpleBlockNote', type: 'object', fields: [ { name: 'title', title: 'Title', type: 'string', }, defineField({ name: 'minutes', type: 'number', title: 'Minutes', validation: (Rul...
1,443
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/portableText/simpleBlockNoteBody.ts
import {defineArrayMember, defineField, defineType} from 'sanity' export default defineType({ name: 'simpleBlockNoteBody', title: 'Body', type: 'array', of: [ { type: 'simpleBlockNoteUrl', name: 'ul', title: 'URL', }, { type: 'block', of: [ { type: 'r...
1,444
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/portableText/simpleBlockNoteUrl.ts
import {defineType} from 'sanity' export default defineType({ name: 'simpleBlockNoteUrl', type: 'object', title: 'URL', fields: [ { name: 'url', type: 'url', title: 'URL', }, ], preview: { select: { url: 'url', }, }, })
1,445
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/portableText/spotifyEmbed.tsx
import React from 'react' import {defineType, PreviewProps} from 'sanity' const IFRAME_URL_RE = /^<iframe src="([^"]+)"/ function parseSpotifyShareUrl(str: string): {type: string; id: string} | null { if (str.startsWith('https://')) { const url = new URL(str) const parts = url.pathname.slice(1).split('/') ...
1,446
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/portableText
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/portableText/components/CalloutPreview.tsx
import {Box, Card, CardTone, Flex, Text} from '@sanity/ui' import React from 'react' import {PreviewProps} from 'sanity' function isRecord(value: unknown): value is Record<string, unknown> { return Boolean(value) && typeof value === 'object' && !Array.isArray(value) } function isString(value: unknown): value is str...
1,447
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/portableText
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/portableText/customMarkers/CustomContentInput.tsx
import React, {useCallback, useMemo} from 'react' import {PortableTextInput, PortableTextInputProps, PortableTextMarker} from 'sanity' import {htmlToBlocks} from '@sanity/block-tools' import {OnPasteFn, PortableTextBlock} from '@sanity/portable-text-editor' import {renderBlockActions} from './blockActions' import {rend...
1,448
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/portableText
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/portableText/customMarkers/blockActions.tsx
import {CommentIcon} from '@sanity/icons' import {PortableTextBlock} from '@sanity/portable-text-editor' import {Box, Button, Popover, Stack, Text, TextArea} from '@sanity/ui' import React, {ChangeEvent, useCallback, useState} from 'react' import {RenderBlockActionsCallback} from 'sanity' export const renderBlockActio...
1,449
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/portableText
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/portableText/customMarkers/customMarkers.tsx
import {Card, Stack, Text} from '@sanity/ui' import React from 'react' import {RenderCustomMarkers} from 'sanity' export const renderCustomMarkers: RenderCustomMarkers = (markers) => { return ( <Stack space={1}> {markers.map((marker, index) => ( <Card key={index} padding={2} tone="transparent"> ...
1,450
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/portableText
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/portableText/customMarkers/index.ts
export * from './schemaTypes'
1,451
0
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/portableText
petrpan-code/sanity-io/sanity/dev/test-studio/schema/standard/portableText/customMarkers/schemaTypes.tsx
import React from 'react' import {defineType} from 'sanity' import {LinkIcon, RocketIcon} from '@sanity/icons' import {CustomContentInput} from './CustomContentInput' const boostRender = (props: any) => ( <span style={{backgroundColor: 'yellow'}}>{props.children}</span> ) const normalRender = (props: any) => <span ...
1,452
0
petrpan-code/sanity-io/sanity/dev/test-studio/scripts
petrpan-code/sanity-io/sanity/dev/test-studio/scripts/workshop/build.ts
import fs from 'fs' import path from 'path' import globby from 'globby' const ROOT_PATH = path.resolve(__dirname, '../../../..') const WORKSHOP_SRC_PATH = path.resolve(__dirname, '../../workshop') const WORKSHOP_SCOPES_PATH = path.resolve(WORKSHOP_SRC_PATH, 'scopes.js') const WORKSHOP_PATTERNS = [ path.resolve(ROOT...
1,453
0
petrpan-code/sanity-io/sanity/dev/test-studio/scripts
petrpan-code/sanity-io/sanity/dev/test-studio/scripts/workshop/dev.ts
import fs from 'fs' import path from 'path' import globby from 'globby' import chokidar from 'chokidar' const ROOT_PATH = path.resolve(__dirname, '../../../..') const WORKSHOP_SRC_PATH = path.resolve(__dirname, '../../workshop') const WORKSHOP_SCOPES_PATH = path.resolve(WORKSHOP_SRC_PATH, 'scopes.js') const WORKSHOP_...
1,454
0
petrpan-code/sanity-io/sanity/dev/test-studio
petrpan-code/sanity-io/sanity/dev/test-studio/static/someStaticFile.txt
Should be copied on build! And served under /static in dev
1,455
0
petrpan-code/sanity-io/sanity/dev/test-studio
petrpan-code/sanity-io/sanity/dev/test-studio/structure/_buildTypeGroup.ts
import {StructureBuilder} from 'sanity/desk' import {Schema} from '@sanity/types' import {isObject} from 'lodash' import {PreviewLayoutKey} from 'sanity' const isNonNullable = isObject as <T>(value: T) => value is NonNullable<T> type ListItemBuilder = ReturnType<StructureBuilder['listItem']> interface TypeGroupOpts ...
1,456
0
petrpan-code/sanity-io/sanity/dev/test-studio
petrpan-code/sanity-io/sanity/dev/test-studio/structure/_helpers.ts
// For testing. Bump the timeout to introduce som lag export function delayValue<T>(val: T, ms = 10): Promise<T> { return new Promise((resolve) => setTimeout(resolve, ms, val)) }
1,457
0
petrpan-code/sanity-io/sanity/dev/test-studio
petrpan-code/sanity-io/sanity/dev/test-studio/structure/constants.ts
export const STANDARD_INPUT_TYPES = [ 'arraysTest', 'booleansTest', 'dateTest', 'datetimeTest', 'emailsTest', 'filesTest', 'imagesTest', 'numbersTest', 'objectsTest', 'referenceTest', 'slugsTest', 'stringsTest', 'textsTest', 'urlsTest', ] export const STANDARD_PORTABLE_TEXT_INPUT_TYPES = [ ...
1,458
0
petrpan-code/sanity-io/sanity/dev/test-studio
petrpan-code/sanity-io/sanity/dev/test-studio/structure/groupByOption.ts
import type {StructureBuilder} from 'sanity/desk' import {ObjectOptions, Schema} from '@sanity/types' type StructureGroup = 'v3' | '3d' // extend with union strings export interface StructureGroupOption { structureGroup?: StructureGroup } type MaybeStructureOptions = StructureGroupOption | undefined export functi...
1,459
0
petrpan-code/sanity-io/sanity/dev/test-studio
petrpan-code/sanity-io/sanity/dev/test-studio/structure/index.ts
export * from './resolveStructureDocumentNode' export * from './resolveStructure' export * from './resolveNewDocumentOptions'
1,460
0
petrpan-code/sanity-io/sanity/dev/test-studio
petrpan-code/sanity-io/sanity/dev/test-studio/structure/resolveNewDocumentOptions.ts
import {NewDocumentOptionsResolver} from 'sanity' export const newDocumentOptions: NewDocumentOptionsResolver = (prev, {creationContext}) => { if (creationContext.type === 'structure' && creationContext.schemaType === 'book') { return [ ...prev, { templateId: 'book-by-author', title: ...
1,461
0
petrpan-code/sanity-io/sanity/dev/test-studio
petrpan-code/sanity-io/sanity/dev/test-studio/structure/resolveStructure.ts
import { EarthGlobeIcon, ImagesIcon, PlugIcon, RocketIcon, SyncIcon, TerminalIcon, UsersIcon, JoystickIcon, CodeIcon, } from '@sanity/icons' import {uuid} from '@sanity/uuid' import {DocumentStore, SanityDocument, Schema} from 'sanity' import {ItemChild, StructureBuilder, StructureResolver} from 'sani...
1,462
0
petrpan-code/sanity-io/sanity/dev/test-studio
petrpan-code/sanity-io/sanity/dev/test-studio/structure/resolveStructureDocumentNode.ts
import {DefaultDocumentNodeResolver} from 'sanity/desk' import {JSONPreviewDocumentView} from '../components/documentViews/jsonPreview' export const defaultDocumentNode: DefaultDocumentNodeResolver = (S, {schemaType}) => { if (schemaType === 'author') { return S.document().views([ S.view.form(), S.vi...
1,463
0
petrpan-code/sanity-io/sanity/dev/test-studio
petrpan-code/sanity-io/sanity/dev/test-studio/themes/google.ts
import {buildLegacyTheme} from 'sanity' const props = { '--google-white': '#fff', '--google-black': '#1a1a1a', '--google-blue': '#4285f4', '--google-red': '#db4437', '--google-yellow': '#f4b400', '--google-green': '#0f9d58', } export const googleTheme = buildLegacyTheme({ /* Base theme colors */ '--bl...
1,464
0
petrpan-code/sanity-io/sanity/dev/test-studio
petrpan-code/sanity-io/sanity/dev/test-studio/themes/vercel.ts
import {buildLegacyTheme} from 'sanity' const color = { 'geist-foreground': '#000', 'geist-background': '#fff', 'geist-success': '#2276fc', 'geist-error': '#f03e2f', 'geist-warning': '#f5a623', 'geist-warning-lighter': '#ffefcf', 'geist-highlight-purple': '#f81ce5', 'accents-1': '#fafafa', 'accents-...
1,465
0
petrpan-code/sanity-io/sanity/dev/test-studio
petrpan-code/sanity-io/sanity/dev/test-studio/typings/css-modules.d.ts
declare module '*.module.css' { const classNames: Record<string, string | undefined> export default classNames }
1,466
0
petrpan-code/sanity-io/sanity/dev/test-studio
petrpan-code/sanity-io/sanity/dev/test-studio/workshop/WorkshopTool.tsx
import {Tool, useColorScheme, useWorkspace} from 'sanity' import React from 'react' import {Workshop} from '@sanity/ui-workshop' import {WorkshopOptions} from './types' import {config} from './config' import {useLocationStore} from './useLocationStore' export function WorkshopTool(props: {tool: Tool<WorkshopOptions>})...
1,467
0
petrpan-code/sanity-io/sanity/dev/test-studio
petrpan-code/sanity-io/sanity/dev/test-studio/workshop/config.ts
import {WorkshopConfig} from '@sanity/ui-workshop' import {a11yPlugin} from '@sanity/ui-workshop/plugin-a11y' import {perfPlugin} from '@sanity/ui-workshop/plugin-perf' import {scopes} from './scopes' export const config: WorkshopConfig = { frameUrl: '/workshop/frame/', plugins: [perfPlugin(), a11yPlugin()], sco...
1,468
0
petrpan-code/sanity-io/sanity/dev/test-studio
petrpan-code/sanity-io/sanity/dev/test-studio/workshop/index.ts
import {TerminalIcon} from '@sanity/icons' import {definePlugin} from 'sanity' import {route} from 'sanity/router' import {WorkshopTool} from './WorkshopTool' import {WorkshopOptions} from './types' export const workshopTool = definePlugin<WorkshopOptions>((options) => ({ name: '@local/workshop', tools: [ { ...
1,469
0
petrpan-code/sanity-io/sanity/dev/test-studio
petrpan-code/sanity-io/sanity/dev/test-studio/workshop/scopes.d.ts
import {WorkshopScope} from '@sanity/ui-workshop' export const scopes: WorkshopScope[]
1,470
0
petrpan-code/sanity-io/sanity/dev/test-studio
petrpan-code/sanity-io/sanity/dev/test-studio/workshop/types.ts
export interface WorkshopOptions { collections?: {name: string; title: string}[] icon?: React.ComponentType name?: string title?: string }
1,471
0
petrpan-code/sanity-io/sanity/dev/test-studio
petrpan-code/sanity-io/sanity/dev/test-studio/workshop/useLocationStore.ts
import {useRouter} from 'sanity/router' import {WorkshopLocation, WorkshopLocationStore} from '@sanity/ui-workshop' import qs from 'qs' import {useCallback, useMemo, useRef} from 'react' export function useLocationStore(props: {baseUrl?: string} = {}): WorkshopLocationStore { const {baseUrl = ''} = props const {na...
1,472
0
petrpan-code/sanity-io/sanity/dev/test-studio/workshop
petrpan-code/sanity-io/sanity/dev/test-studio/workshop/frame/index.html
<!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no, viewport-fit=cover" /> <style> html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; ...
1,473
0
petrpan-code/sanity-io/sanity/dev/test-studio/workshop
petrpan-code/sanity-io/sanity/dev/test-studio/workshop/frame/main.tsx
import {StudioProvider} from 'sanity' import {ThemeColorSchemeKey, usePrefersDark} from '@sanity/ui' import {WorkshopFrame} from '@sanity/ui-workshop' import React, {useState} from 'react' import {createRoot} from 'react-dom/client' import Refractor from 'react-refractor' import javascript from 'refractor/lang/javascri...
1,474
0
petrpan-code/sanity-io/sanity/examples
petrpan-code/sanity-io/sanity/examples/blog-studio/LICENSE
MIT License Copyright (c) 2016 - 2023 Sanity.io 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, ...
1,475
0
petrpan-code/sanity-io/sanity/examples
petrpan-code/sanity-io/sanity/examples/blog-studio/README.md
# blog-studio Content studio running with schema from the blog init template Start from project root directory with npm run blog-studio
1,476
0
petrpan-code/sanity-io/sanity/examples
petrpan-code/sanity-io/sanity/examples/blog-studio/package.json
{ "name": "blog-studio", "version": "3.20.1", "private": true, "description": "Content studio running with schema from the blog init template", "keywords": [ "sanity", "cms", "headless", "realtime", "content", "blog-studio" ], "homepage": "https://www.sanity.io/", "bugs": { "...
1,477
0
petrpan-code/sanity-io/sanity/examples
petrpan-code/sanity-io/sanity/examples/blog-studio/sanity.config.ts
import {defineConfig} from 'sanity' import {deskTool} from 'sanity/desk' import {schemaTypes} from '../../packages/@sanity/cli/templates/blog/schemas' export default defineConfig({ name: 'default', title: 'Blog studio example', projectId: 'ppsg7ml5', dataset: 'blog', schema: { types: schemaTypes, }, ...
1,478
0
petrpan-code/sanity-io/sanity/examples
petrpan-code/sanity-io/sanity/examples/clean-studio/.depcheckignore.json
{ "ignore": ["styled-components", "react", "react-dom", "sanity"] }
1,479
0
petrpan-code/sanity-io/sanity/examples
petrpan-code/sanity-io/sanity/examples/clean-studio/LICENSE
MIT License Copyright (c) 2016 - 2023 Sanity.io 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, ...
1,480
0
petrpan-code/sanity-io/sanity/examples
petrpan-code/sanity-io/sanity/examples/clean-studio/README.md
# Sanity Clean Content Studio Congratulations, you have now installed the Sanity Content Studio, an open source real-time content editing environment connected to the Sanity backend. Now you can do the following things: - [Read “getting started” in the docs](https://www.sanity.io/docs/getting-started-with-sanity?utm...
1,481
0
petrpan-code/sanity-io/sanity/examples
petrpan-code/sanity-io/sanity/examples/clean-studio/package.json
{ "name": "clean-studio", "version": "3.20.1", "private": true, "description": "Content studio running with schema from the clean template", "keywords": [ "sanity", "cms", "headless", "realtime", "content", "clean-studio" ], "homepage": "https://www.sanity.io/", "bugs": { "ur...
1,482
0
petrpan-code/sanity-io/sanity/examples
petrpan-code/sanity-io/sanity/examples/clean-studio/sanity.config.ts
import {defineConfig} from 'sanity' import {deskTool} from 'sanity/desk' import {schemaTypes} from '../../packages/@sanity/cli/templates/clean/schemas' export default defineConfig({ name: 'default', title: 'Clean studio', projectId: 'ppsg7ml5', dataset: 'clean', schema: { types: schemaTypes, }, pl...
1,483
0
petrpan-code/sanity-io/sanity/examples
petrpan-code/sanity-io/sanity/examples/ecommerce-studio/.depcheckignore.json
{ "//": "Note: the schema is imported from the cli package, so these can safely be ignored as long as they are added to the template's package json", "ignore": ["react-barcode"] }
1,484
0
petrpan-code/sanity-io/sanity/examples
petrpan-code/sanity-io/sanity/examples/ecommerce-studio/LICENSE
MIT License Copyright (c) 2016 - 2023 Sanity.io 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, ...
1,485
0
petrpan-code/sanity-io/sanity/examples
petrpan-code/sanity-io/sanity/examples/ecommerce-studio/package.json
{ "name": "ecommerce-studio", "version": "3.20.1", "private": true, "description": "", "keywords": [ "sanity", "cms", "headless", "realtime", "content", "ecommerce-studio" ], "homepage": "https://www.sanity.io/", "bugs": { "url": "https://github.com/sanity-io/sanity/issues" ...
1,486
0
petrpan-code/sanity-io/sanity/examples
petrpan-code/sanity-io/sanity/examples/ecommerce-studio/sanity.config.ts
import {defineConfig} from 'sanity' import {deskTool} from 'sanity/desk' import {schemaTypes} from '../../packages/@sanity/cli/templates/ecommerce/schemas' import {barcodeInput} from './plugins/barcode-input' export default defineConfig({ name: 'default', title: 'Sanity E-commerce example studio', projectId: 'r...
1,487
0
petrpan-code/sanity-io/sanity/examples/ecommerce-studio/plugins
petrpan-code/sanity-io/sanity/examples/ecommerce-studio/plugins/barcode-input/BarcodeInput.tsx
// Copied from packages/@sanity/cli/templates/ecommerce/plugins/barcode-input/BarcodeInput.js import React, {useState} from 'react' import {Box, Text} from '@sanity/ui' import Barcode from 'react-barcode' import {FieldMember, MemberField, ObjectInputProps} from 'sanity' import styled from 'styled-components' const Ba...
1,488
0
petrpan-code/sanity-io/sanity/examples/ecommerce-studio/plugins
petrpan-code/sanity-io/sanity/examples/ecommerce-studio/plugins/barcode-input/index.ts
import {definePlugin} from 'sanity' import {barcodeSchemaType} from './schemaType' export const barcodeInput = definePlugin({ name: 'barcode-input', schema: { types: [barcodeSchemaType], }, })
1,489
0
petrpan-code/sanity-io/sanity/examples/ecommerce-studio/plugins
petrpan-code/sanity-io/sanity/examples/ecommerce-studio/plugins/barcode-input/schemaType.ts
// Copied from packages/@sanity/cli/templates/ecommerce/plugins/barcode-input/BarcodeType.js import {defineField, defineType} from 'sanity' import {BarcodeInput} from './BarcodeInput' export const barcodeSchemaType = defineType({ name: 'barcode', title: 'Barcode', type: 'object', components: { input: Bar...
1,490
0
petrpan-code/sanity-io/sanity/examples
petrpan-code/sanity-io/sanity/examples/movies-studio/LICENSE
MIT License Copyright (c) 2016 - 2023 Sanity.io 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, ...
1,491
0
petrpan-code/sanity-io/sanity/examples
petrpan-code/sanity-io/sanity/examples/movies-studio/README.md
# movies-studio Content studio running with schema from the moviedb init template Start from project root directory with npm run movies-studio
1,492
0
petrpan-code/sanity-io/sanity/examples
petrpan-code/sanity-io/sanity/examples/movies-studio/package.json
{ "name": "movies-studio", "version": "3.20.1", "private": true, "description": "Content studio running with schema from the moviedb init template", "keywords": [ "sanity", "cms", "headless", "realtime", "content", "movies-studio" ], "homepage": "https://www.sanity.io/", "bugs": ...
1,493
0
petrpan-code/sanity-io/sanity/examples
petrpan-code/sanity-io/sanity/examples/movies-studio/resolveProductionUrl.ts
const SITE_URL = 'https://sanity-example-frontend.now.sh' function stripDraftId(str) { return str.replace(/^drafts\./, '') } export function resolveProductionUrl(document, rev) { const id = stripDraftId(document._id) if (rev) { // No support for historic revisions preview in movie frontend return null ...
1,494
0
petrpan-code/sanity-io/sanity/examples
petrpan-code/sanity-io/sanity/examples/movies-studio/sanity.config.ts
import {defineConfig} from 'sanity' import {deskTool} from 'sanity/desk' import {googleMapsInput} from '@sanity/google-maps-input' import {schemaTypes} from '../../packages/@sanity/cli/templates/moviedb/schemas' import {BrandLogo} from './components/BrandLogo' export default defineConfig({ name: 'default', title:...
1,495
0
petrpan-code/sanity-io/sanity/examples/movies-studio
petrpan-code/sanity-io/sanity/examples/movies-studio/components/BrandLogo.tsx
import React from 'react' export const BrandLogo = () => ( <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 530"> <g> <path fill="none" d="M630.212,247.44c2.502-2.081,4.967-4.198,7.395-6.352h-8.238c-0.053,2.124-0.135,4.242-0.24,6.352H630.212z" /> <path d="M579.996,281.67...
1,496
0
petrpan-code/sanity-io/sanity/packages/@sanity
petrpan-code/sanity-io/sanity/packages/@sanity/block-tools/.depcheckignore.json
{ "ignore": ["@optimize-lodash/rollup-plugin", "@sanity/pkg-utils"] }
1,497
0
petrpan-code/sanity-io/sanity/packages/@sanity
petrpan-code/sanity-io/sanity/packages/@sanity/block-tools/.eslintrc.cjs
'use strict' const path = require('path') const ROOT_PATH = path.resolve(__dirname, '../../..') module.exports = { rules: { 'import/no-extraneous-dependencies': ['error', {packageDir: [ROOT_PATH, __dirname]}], }, }
1,498
0
petrpan-code/sanity-io/sanity/packages/@sanity
petrpan-code/sanity-io/sanity/packages/@sanity/block-tools/LICENSE
MIT License Copyright (c) 2016 - 2023 Sanity.io 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, ...
1,499