create-asciitorium 0.1.20 → 0.1.22

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.
@@ -1,3 +1,4 @@
1
+ @import url('https://fonts.cdnfonts.com/css/jetbrains-mono');
1
2
  @font-face {
2
3
  font-family: 'PrintChar21';
3
4
  src:
@@ -9,15 +10,31 @@
9
10
  }
10
11
 
11
12
  body {
12
- font-family: 'Courier New', Courier, monospace;
13
- margin: 10;
13
+ font-family: 'JetBrains Mono', sans-serif;
14
+ margin: 0;
14
15
  background: black;
15
16
  color: #3fff00;
16
17
 
17
- /* Center the screen horizontally */
18
+ /* Center the screen both horizontally and vertically */
18
19
  display: flex;
19
20
  justify-content: center;
21
+ align-items: center;
20
22
  height: 100vh; /* Full viewport height */
23
+ width: 100vw; /* Full viewport width */
24
+ }
25
+
26
+ #screen {
27
+ /* Use 90% of viewport dimensions to leave some margin */
28
+ width: 90vw;
29
+ height: 90vh;
30
+ margin: 0;
31
+ padding: 0;
32
+ overflow: hidden; /* Hide scrollbars for clean appearance */
33
+
34
+ /* Ensure monospace font for proper character sizing */
35
+ font-family: 'PrintChar21', 'Courier New', Courier, monospace;
36
+ font-size: 16px; /* Base font size for character measurement */
37
+ line-height: 1; /* Tight line spacing for ASCII art */
21
38
  }
22
39
 
23
40
  .inverted {
@@ -2,12 +2,12 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>asciitorium app</title>
5
+ <title>asciitorium</title>
6
+ <link rel="icon" type="image/png" href="/logo.png" />
7
7
  <link rel="stylesheet" href="index.css" />
8
8
  </head>
9
9
  <body>
10
- <div id="screen"></div>
11
- <script type="module" src="src/main.tsx"></script>
10
+ <pre id="screen">Loading...</pre>
11
+ <script type="module" src="/src/main.tsx"></script>
12
12
  </body>
13
13
  </html>
@@ -3,7 +3,7 @@ import { AsciiArt, Box, loadArt } from 'asciitorium';
3
3
  const computer = await loadArt('./art/computer.txt');
4
4
 
5
5
  export const AsciiArtExample = () => (
6
- <Box width={42} height={28} layout="relaxed" label="ASCII Art Example:" border>
6
+ <Box width={42} height={28} layout="aligned" label="ASCII Art Example:" border>
7
7
  <AsciiArt content={computer} align="center" />
8
8
  </Box>
9
9
  );
@@ -12,7 +12,7 @@ export const ButtonExample = () => {
12
12
  onClick={() => (buttonClickCount.value = buttonClickCount.value + 1)}
13
13
  gap={{top: 4, bottom: 3}}
14
14
  />
15
- <Box layout="horizontal" gap={{left: 6, right: 2}} align="center">
15
+ <Box layout="row" gap={{left: 6, right: 2}} align="center">
16
16
  <Text>Click Count: </Text>
17
17
  <Text width={4}>{buttonClickCount}</Text>
18
18
  </Box>
@@ -1,7 +1,7 @@
1
1
  import { Text, HR, VR, Box, CelticBorder } from 'asciitorium';
2
2
 
3
3
  export const LayoutExample = () => (
4
- <Box width={42} height={27} border layout="vertical">
4
+ <Box width={42} height={27} border layout="column">
5
5
  <Text
6
6
  width={40}
7
7
  height={2}
@@ -37,7 +37,7 @@ export const MultiSelectExample = () => {
37
37
  selectedItems={multiValue}
38
38
  gap={{ top: 2, bottom: 2 }}
39
39
  />
40
- <Box align="center" layout="horizontal">
40
+ <Box align="center" layout="row">
41
41
  <Text align="top">Selected: </Text>
42
42
  <Text
43
43
  width={24}
@@ -31,7 +31,7 @@ export const SelectExample = () => {
31
31
  selectedItem={selectValue}
32
32
  />
33
33
  </Box>
34
- <Box align="center" gap={{ left: 5 }} layout="horizontal">
34
+ <Box align="center" gap={{ left: 5 }} layout="row">
35
35
  <Text>Car Selected: </Text>
36
36
  <Text width={20}>{selectValue}</Text>
37
37
  </Box>
@@ -1,23 +1,25 @@
1
1
  import {
2
2
  App,
3
- Text,
4
3
  AsciiArt,
5
4
  Select,
6
- Box,
7
5
  Component,
6
+ Row,
8
7
  PersistentState,
9
8
  loadArt,
10
9
  } from 'asciitorium';
11
10
 
12
- // Import example components
13
- import { ButtonExample } from './examples/ButtonExample';
14
- import { SelectExample } from './examples/SelectExample';
15
- import { MultiSelectExample } from './examples/MultiSelectExample';
16
- import { TextInputExample } from './examples/TextInputExample';
17
- import { ProgressBarExample } from './examples/ProgressBarExample';
18
- import { TabsExample } from './examples/TabsExample';
19
- import { TextExample } from './examples/TextExample';
20
- import { AsciiArtExample } from './examples/AsciiArtExample';
11
+ import {
12
+ ButtonExample,
13
+ CelticBorderExample,
14
+ SelectExample,
15
+ MultiSelectExample,
16
+ RelativeSizingExample,
17
+ TextInputExample,
18
+ TabsExample,
19
+ TextExample,
20
+ AsciiArtExample,
21
+ SlidersExample,
22
+ } from 'asciitorium/examples';
21
23
 
22
24
  // Load the title ASCII art
23
25
  const titleArt = await loadArt('./art/asciitorium.txt');
@@ -32,102 +34,51 @@ const selectedComponent = new PersistentState(
32
34
  const componentList = [
33
35
  'AsciiArt',
34
36
  'Button',
37
+ 'CelticBorder',
35
38
  'MultiSelect',
36
- 'ProgressBar',
39
+ 'RelativeSizing',
37
40
  'Select',
41
+ 'Sliders',
38
42
  'Tabs',
39
43
  'Text',
40
- 'TextInput'
44
+ 'TextInput',
41
45
  ];
42
46
 
43
- // Component mapping
44
- const examples: Record<string, any> = {
47
+ // Component mapping for dynamic content
48
+ const examples = {
45
49
  Button: ButtonExample,
50
+ CelticBorder: CelticBorderExample,
46
51
  Select: SelectExample,
47
52
  MultiSelect: MultiSelectExample,
53
+ RelativeSizing: RelativeSizingExample,
48
54
  TextInput: TextInputExample,
49
- ProgressBar: ProgressBarExample,
55
+ Sliders: SlidersExample,
50
56
  Tabs: TabsExample,
51
57
  Text: TextExample,
52
- AsciiArt: AsciiArtExample
58
+ AsciiArt: AsciiArtExample,
53
59
  };
54
60
 
55
- // Create a wrapper component that dynamically switches based on state
56
-
57
- class DynamicExampleWrapper extends Box {
58
- constructor() {
59
- super({ width: 53, height: 28 });
60
-
61
- // Initially set the current example
62
- this.updateExample();
63
-
64
- // Subscribe to changes in selectedComponent
65
- selectedComponent.subscribe(() => {
66
- this.updateExample();
67
- });
68
- }
69
-
70
- private updateExample() {
71
- // Properly remove existing children using removeChild to notify parent
72
- const childrenToRemove = [...this.children]; // Create copy to avoid mutation during iteration
73
- for (const child of childrenToRemove) {
74
- child.destroy();
75
- this.removeChild(child);
76
- }
77
-
78
- // Get the current example factory function
79
- const exampleFactory = examples[selectedComponent.value];
80
- if (exampleFactory) {
81
- // Call the factory function to create a new component instance
82
- const exampleComponent = exampleFactory();
83
- this.addChild(exampleComponent);
84
- } else {
85
- // Fallback for unknown component
86
- this.addChild(
87
- new Text({
88
- width: 40,
89
- height: 5,
90
- border: true,
91
- children: ['Unknown component'],
92
- })
93
- );
94
- }
95
-
96
- // Find the root App component and reset focus manager
97
- this.notifyAppOfFocusChange();
98
- }
99
-
100
- private notifyAppOfFocusChange() {
101
- // Walk up the parent chain to find the App
102
- let current: Component | undefined = this;
103
- while (current && current.constructor.name !== 'App') {
104
- current = current.parent;
105
- }
106
-
107
- // If we found the App, reset its focus manager
108
- if (current && (current as any).focus) {
109
- (current as any).focus.reset(current);
110
- }
111
- }
112
- }
113
-
114
- // Construct the app with horizontal layout
115
61
  const app = (
116
- <App width={67} height={35}>
62
+ <App>
117
63
  <AsciiArt content={titleArt} align="center" gap={{ bottom: 2 }} />
118
- <Box layout="horizontal">
119
- {/* Left Panel - Navigation */}
64
+ <Row height="fit">
120
65
  <Select
121
66
  label="Components:"
122
- width={25}
123
- height={28}
67
+ width="30%"
68
+ height="fit"
124
69
  items={componentList}
125
70
  selectedItem={selectedComponent}
126
71
  border
127
72
  />
128
- {/* Right Panel - Dynamic content */}
129
- {new DynamicExampleWrapper()}
130
- </Box>
73
+ <Component
74
+ width="fit"
75
+ height="fit"
76
+ dynamicContent={{
77
+ selectedKey: selectedComponent,
78
+ componentMap: examples,
79
+ }}
80
+ />
81
+ </Row>
131
82
  </App>
132
83
  );
133
84
 
@@ -1,4 +1,4 @@
1
- import { defineConfig } from 'vite';
1
+ import { defineConfig, Plugin } from 'vite';
2
2
 
3
3
  // Minimal virtual shim for Node built-ins on the web build
4
4
  function nodeBuiltinsShim(): Plugin {
@@ -26,7 +26,11 @@ function nodeBuiltinsShim(): Plugin {
26
26
  }
27
27
 
28
28
  export default defineConfig({
29
- esbuild: { target: 'esnext' },
29
+ esbuild: {
30
+ target: 'esnext',
31
+ jsx: 'automatic',
32
+ jsxImportSource: 'asciitorium',
33
+ },
30
34
  build: { target: 'esnext' },
31
35
  plugins: [nodeBuiltinsShim()],
32
36
  server: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-asciitorium",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
4
4
  "private": false,
5
5
  "description": "Scaffold a Vite + TypeScript project prewired for asciitorium (web + cli).",
6
6
  "bin": {