Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing type to replace in editor, fix split layout #43

Merged
merged 8 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const fs = require('fs')

const prefixes = ['zss']
const prefixes = ['zss', 'cafe']

const srcFolders = prefixes
.map((folder) =>
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/on-push-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ jobs:
env:
REPO: self
BRANCH: public # The branch name where you want to push the assets
FOLDER: ./zss/terminal/dist # The directory where your assets are generated
FOLDER: ./cafe/dist # The directory where your assets are generated
MESSAGE: 'Build: ({sha}) {msg}' # The commit message
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub will automatically add this - you don't need to bother getting a token
File renamed without changes.
File renamed without changes.
4 changes: 1 addition & 3 deletions zss/terminal/app.tsx → cafe/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ import {
import { vm_loadfile } from 'zss/device/api'
import { enableaudio } from 'zss/device/synth'
import { getgadgetclientplayer } from 'zss/gadget/data/state'
import { Terminal } from 'zss/gadget/terminal'
import { ispresent } from 'zss/mapping/types'

import { Terminal } from './terminal'

import 'zss/platform'

extend({
Expand Down
File renamed without changes.
12 changes: 12 additions & 0 deletions cafe/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
html,
body {
margin: 0;
padding: 0;
height: 100%;
overflow: hidden;
background: rgb(0, 0, 0);
background: linear-gradient(0deg,
rgba(0, 0, 0, 1) 0%,
rgba(17, 17, 17, 1) 35%,
rgba(53, 53, 53, 1) 100%);
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "zed-software-system",
"private": true,
"version": "0.20.18",
"version": "0.20.21",
"type": "module",
"scripts": {
"sloc": "npx sloc zss",
Expand All @@ -12,8 +12,8 @@
"preview": "yarn && yarn clear && vite preview",
"build": "yarn && yarn clear && vite build",
"build:strict": "tsc && vite build",
"build:copy-404": "cp ./404.html ./zss/terminal/dist",
"build:copy-cname": "cp .github/CNAME ./zss/terminal/dist"
"build:copy-404": "cp ./404.html ./cafe/dist",
"build:copy-cname": "cp .github/CNAME ./cafe/dist"
},
"dependencies": {},
"devDependencies": {
Expand Down
25 changes: 20 additions & 5 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,22 @@
"target": "ES2020",
"useDefineForClassFields": true,
"paths": {
"zss/*": ["./zss/*"]
"zss/*": [
"./zss/*"
],
"cafe/*": [
"./cafe/*"
],
},
"lib": ["ES2021", "DOM", "DOM.Iterable", "WEBWORKER"],
"types": ["vite-plugin-arraybuffer/types"],
"lib": [
"ES2021",
"DOM",
"DOM.Iterable",
"WEBWORKER"
],
"types": [
"vite-plugin-arraybuffer/types"
],
"module": "ESNext",
"skipLibCheck": true,
/* Bundler mode */
Expand All @@ -22,10 +34,13 @@
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["zss"],
"include": [
"zss",
"cafe",
],
"references": [
{
"path": "./tsconfig.node.json"
}
]
}
}
8 changes: 6 additions & 2 deletions tsconfig.lint.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"extends": "./tsconfig.json",
"include": ["zss", "vite.config.ts"]
}
"include": [
"zss",
"cafe",
"vite.config.ts"
]
}
6 changes: 4 additions & 2 deletions tsconfig.node.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
"allowSyntheticDefaultImports": true,
"strict": true
},
"include": ["vite.config.ts"]
}
"include": [
"vite.config.ts"
]
}
3 changes: 2 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import pkg from './package.json'
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const envprefix = 'ZSS_'
const root = path.join('zss', 'terminal')
const root = path.join('cafe')
const apppath = path.join(process.cwd(), root)

// Load app-level env vars to node-level env vars.
Expand Down Expand Up @@ -47,6 +47,7 @@ export default defineConfig(({ mode }) => {
resolve: {
alias: {
zss: path.resolve(__dirname, './zss'),
cafe: path.resolve(__dirname, './cafe'),
},
},
}
Expand Down
26 changes: 20 additions & 6 deletions zss/device/synth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ export function enableaudio() {
function createsynth() {
const destination = getDestination()

const mainvolume = new Volume(6)
const mainvolume = new Volume()
mainvolume.volume.value = 8
mainvolume.connect(destination)

const maincompressor = new Compressor({
Expand All @@ -69,10 +70,10 @@ function createsynth() {
})
maincompressor.connect(mainvolume)

const maingain = new Gain(0.888)
const maingain = new Gain()
maingain.connect(maincompressor)

const drumgain = new Gain(0.777)
const drumgain = new Gain()
drumgain.connect(maincompressor)

const SOURCE = [
Expand Down Expand Up @@ -582,7 +583,14 @@ function createsynth() {
// start it
pacer.start(0)

return { addplay, SOURCE }
// stop playback
function stopplay() {
pacer.clear()
pacertime = -1
pacercount = 0
}

return { addplay, stopplay, SOURCE }
}

function validatesynthtype(
Expand Down Expand Up @@ -661,7 +669,13 @@ const synthdevice = createdevice('synth', [], (message) => {
// -negative priority means music synth 1-9
// positive priority means sfx synth 0
// only a single set of drums between music & sfx
synth.addplay(priority, buffer)
if (buffer === '') {
// stop playback
synth.stopplay()
} else {
// add to playback
synth.addplay(priority, buffer)
}
}
break
case 'voice':
Expand Down Expand Up @@ -951,7 +965,7 @@ const synthdevice = createdevice('synth', [], (message) => {
switch (config) {
case 'on':
// default on value
fx.wet.value = 0.333
fx.wet.value = 0.2
break
case 'off':
fx.wet.value = 0.0
Expand Down
4 changes: 1 addition & 3 deletions zss/device/tape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,10 @@ createdevice('tape', [], (message) => {
}
if (!editor.open) {
switch (nextlayout as TAPE_DISPLAY) {
case TAPE_DISPLAY.SPLIT_X:
case TAPE_DISPLAY.SPLIT_Y:
case TAPE_DISPLAY.SPLIT_X_ALT:
case TAPE_DISPLAY.SPLIT_Y_ALT:
// skip over these to right
nextlayout = TAPE_DISPLAY.RIGHT
nextlayout = TAPE_DISPLAY.TOP
break
}
}
Expand Down
File renamed without changes.
File renamed without changes.
9 changes: 0 additions & 9 deletions zss/gadget/components/tape/elements/terminalitemactive.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import {
import { useShallow } from 'zustand/react/shallow'

import { useWriteText } from '../hooks'
import { BackPlate } from '../tape/backplate'
import { ConsoleContext } from '../tape/common'

import { ConsoleContext } from './common'
import { BackPlate } from './elements/backplate'
import { TerminalInput } from './elements/terminalinput'
import { TerminalItem } from './elements/terminalitem'
import { TerminalItemActive } from './elements/terminalitemactive'
import { ConsoleInput } from './input'
import { ConsoleItem } from './item'
import { ConsoleItemActive } from './itemactive'

export function TapeTerminal() {
export function TapeConsole() {
const player = useGadgetClientPlayer()
const [terminallogs, editoropen] = useTape(
useShallow((state) => [state.terminal.logs, state.editor.open]),
Expand Down Expand Up @@ -97,13 +97,13 @@ export function TapeTerminal() {
return null
}
return !editoropen && tapeycursor >= y && tapeycursor < ybottom ? (
<TerminalItemActive key={index} text={text} y={y} />
<ConsoleItemActive key={index} text={text} y={y} />
) : (
<TerminalItem key={index} text={text} y={y} />
<ConsoleItem key={index} text={text} y={y} />
)
})}
{!editoropen && (
<TerminalInput
<ConsoleInput
tapeycursor={tapeycursor}
logrowtotalheight={logrowtotalheight}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ import { ispresent } from 'zss/mapping/types'
import { tokenizeandwritetextformat } from 'zss/words/textformat'
import { writetext } from 'zss/words/writeui'

import { useWriteText } from '../../hooks'
import { inputcolor } from '../../panel/common'
import { UserInput } from '../../userinput'
import { TerminalItemInputProps, setuplogitem } from '../common'
import { useWriteText } from '../hooks'
import { inputcolor } from '../panel/common'
import { setuplogitem, ConsoleItemInputProps } from '../tape/common'
import { UserInput } from '../userinput'

export function TerminalCopyIt({
export function ConsoleCopyIt({
blink,
active,
prefix,
label,
words,
y,
}: TerminalItemInputProps) {
}: ConsoleItemInputProps) {
const context = useWriteText()

const invoke = useCallback(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
import { useCallback, useContext } from 'react'
import { tokenizeandwritetextformat } from 'zss/words/textformat'

import { useWriteText } from '../../hooks'
import { inputcolor } from '../../panel/common'
import { UserInput } from '../../userinput'
import { ConsoleContext, TerminalItemInputProps, setuplogitem } from '../common'
import { useWriteText } from '../hooks'
import { inputcolor } from '../panel/common'
import {
ConsoleContext,
ConsoleItemInputProps,
setuplogitem,
} from '../tape/common'
import { UserInput } from '../userinput'

export function TerminalHyperlink({
export function ConsoleHyperlink({
blink,
active,
prefix,
label,
words,
y,
}: TerminalItemInputProps) {
}: ConsoleItemInputProps) {
const context = useWriteText()

const cc = useContext(ConsoleContext)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import {
tape_terminal_inclayout,
vm_cli,
} from 'zss/device/api'
import { Scrollable } from 'zss/gadget/components/scrollable'
import { UserInput, modsfromevent } from 'zss/gadget/components/userinput'
import { useGadgetClientPlayer, useTapeTerminal } from 'zss/gadget/data/state'
import { Scrollable } from 'zss/gadget/scrollable'
import { UserInput, modsfromevent } from 'zss/gadget/userinput'
import { clamp } from 'zss/mapping/number'
import { stringsplice } from 'zss/mapping/string'
import { ispresent } from 'zss/mapping/types'
Expand All @@ -18,15 +18,15 @@ import {
} from 'zss/words/textformat'
import { NAME } from 'zss/words/types'

import { useBlink, useWriteText } from '../../hooks'
import { setuplogitem } from '../common'
import { useBlink, useWriteText } from '../hooks'
import { setuplogitem } from '../tape/common'

type ConsoleInputProps = {
tapeycursor: number
logrowtotalheight: number
}

export function TerminalInput({
export function ConsoleInput({
tapeycursor,
logrowtotalheight,
}: ConsoleInputProps) {
Expand Down
Loading
Loading