create-buntui 0.1.0-alpha.2 → 0.1.0-alpha.4

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.
Files changed (46) hide show
  1. package/dist/main.js +4 -0
  2. package/package.json +8 -9
  3. package/templates/basic/package.json +3 -3
  4. package/templates/basic/src/apps/main/App.vue +29 -0
  5. package/templates/basic/src/apps/main/main.ts +12 -0
  6. package/templates/basic/src/shared/runApp.ts +14 -0
  7. package/templates/full/README.md +14 -12
  8. package/templates/full/package.json +3 -3
  9. package/templates/full/src/apps/main/components/BoxDemo.vue +80 -0
  10. package/templates/full/src/{components → apps/main/components}/ButtonDemo.vue +4 -4
  11. package/templates/full/src/apps/main/components/CheckboxDemo.vue +19 -0
  12. package/templates/full/src/{components → apps/main/components}/InputDemo.vue +6 -8
  13. package/templates/full/src/{components → apps/main/components}/ProgressDemo.vue +3 -3
  14. package/templates/full/src/{components → apps/main/components}/RadioDemo.vue +2 -2
  15. package/templates/full/src/{components → apps/main/components}/ScrollBoxDemo.vue +6 -11
  16. package/templates/full/src/{components → apps/main/components}/SelectDemo.vue +6 -8
  17. package/templates/full/src/apps/main/components/SwitchDemo.vue +19 -0
  18. package/templates/full/src/{components → apps/main/components}/TableDemo.vue +2 -4
  19. package/templates/full/src/apps/main/components/TextDemo.vue +66 -0
  20. package/templates/full/src/apps/main/components/TextareaDemo.vue +38 -0
  21. package/templates/full/src/apps/main/main.ts +12 -0
  22. package/templates/full/src/shared/runApp.ts +14 -0
  23. package/templates/sfc/README.md +5 -3
  24. package/templates/sfc/package.json +3 -3
  25. package/templates/sfc/src/apps/main/App.vue +42 -0
  26. package/templates/sfc/src/apps/main/main.ts +12 -0
  27. package/templates/sfc/src/shared/runApp.ts +14 -0
  28. package/dist/buntui.so +0 -0
  29. package/dist/index.js +0 -7
  30. package/templates/basic/scripts/build.ts +0 -65
  31. package/templates/basic/src/App.vue +0 -31
  32. package/templates/basic/src/dev.ts +0 -27
  33. package/templates/basic/src/main.ts +0 -15
  34. package/templates/full/scripts/build.ts +0 -66
  35. package/templates/full/src/components/BoxDemo.vue +0 -85
  36. package/templates/full/src/components/CheckboxDemo.vue +0 -19
  37. package/templates/full/src/components/SwitchDemo.vue +0 -19
  38. package/templates/full/src/components/TextDemo.vue +0 -72
  39. package/templates/full/src/components/TextareaDemo.vue +0 -37
  40. package/templates/full/src/dev.ts +0 -40
  41. package/templates/full/src/main.ts +0 -21
  42. package/templates/sfc/scripts/build.ts +0 -66
  43. package/templates/sfc/src/App.vue +0 -44
  44. package/templates/sfc/src/dev.ts +0 -40
  45. package/templates/sfc/src/main.ts +0 -21
  46. /package/templates/full/src/{App.vue → apps/main/App.vue} +0 -0
@@ -0,0 +1,19 @@
1
+ <template>
2
+ <Text :x="1" :y="3" value="Checkbox widget — boolean toggle" />
3
+
4
+ <Checkbox :x="1" :y="4" label="Enable feature A" @change="handleChange('A', $event)" />
5
+ <Checkbox :x="1" :y="5" label="Enable feature B" @change="handleChange('B', $event)" />
6
+ <Checkbox :x="1" :y="6" label="Disabled option" :disabled="true" />
7
+
8
+ <Text :x="1" :y="8" :value="log" />
9
+ </template>
10
+
11
+ <script setup lang="ts">
12
+ import { ref } from '@vue/reactivity'
13
+
14
+ const log = ref('Toggle a checkbox above')
15
+
16
+ function handleChange(name: string, event: TuiCheckboxChangeEvent) {
17
+ log.value = `${name}: ${event.checked ? 'checked' : 'unchecked'}`
18
+ }
19
+ </script>
@@ -1,28 +1,26 @@
1
1
  <template>
2
- <Text :x="1" :y="3" :colorFg="'rgba(137,180,250,1)'" value="Input widget — text field with editing support" />
2
+ <Text :x="1" :y="3" value="Input widget — text field with editing support" />
3
3
 
4
4
  <Box
5
5
  :x="1"
6
6
  :y="4"
7
7
  :width="50"
8
- :height="5"
9
- :colorBg="'rgba(30,30,46,1)'"
10
- :borderColor="'rgba(137,180,250,0.5)'"
8
+ :height="8"
11
9
  borderStyle="rounded"
12
- :direction="'vertical'"
10
+ direction="vertical"
13
11
  :gap="1"
14
12
  :paddingTop="1"
15
13
  :paddingLeft="1"
16
14
  >
17
- <Text :colorFg="'rgba(108,112,134,1)'" value="Type something and press Enter:" />
15
+ <Text value="Type something and press Enter:" />
18
16
  <Input
19
17
  :width="46"
20
- :placeholder="'Enter text here...'"
18
+ placeholder="Enter text here..."
21
19
  @submit="handleSubmit"
22
20
  />
23
21
  </Box>
24
22
 
25
- <Text :x="1" :y="10" :colorFg="'rgba(166,227,161,1)'" :value="submittedValue" />
23
+ <Text :x="1" :y="13" :value="submittedValue" />
26
24
  </template>
27
25
 
28
26
  <script setup lang="ts">
@@ -1,10 +1,10 @@
1
1
  <template>
2
- <Text :x="1" :y="3" :colorFg="'rgba(137,180,250,1)'" value="Progress widget — bar indicator" />
2
+ <Text :x="1" :y="3" value="Progress widget — bar indicator" />
3
3
 
4
- <Text :x="1" :y="4" :colorFg="'rgba(108,112,134,1)'" value="Determinate:" />
4
+ <Text :x="1" :y="4" value="Determinate:" />
5
5
  <Progress :x="1" :y="5" :width="40" :height="1" :value="progress" />
6
6
 
7
- <Text :x="1" :y="7" :colorFg="'rgba(166,227,161,1)'" :value="`${Math.round(progress * 100)}%`" />
7
+ <Text :x="1" :y="7" :value="`${Math.round(progress * 100)}%`" />
8
8
 
9
9
  <Button :x="1" :y="9" :width="20" :height="3" value="Reset" @click="reset" />
10
10
  <Button :x="23" :y="9" :width="20" :height="3" value="Set 75%" @click="set75" />
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <Text :x="1" :y="3" :colorFg="'rgba(137,180,250,1)'" value="RadioGroup widget — single selection from options" />
2
+ <Text :x="1" :y="3" value="RadioGroup widget — single selection from options" />
3
3
 
4
4
  <RadioGroup
5
5
  :x="1"
@@ -9,7 +9,7 @@
9
9
  @change="handleChange"
10
10
  />
11
11
 
12
- <Text :x="1" :y="8" :colorFg="'rgba(108,112,134,1)'" :value="log" />
12
+ <Text :x="1" :y="8" :value="log" />
13
13
  </template>
14
14
 
15
15
  <script setup lang="ts">
@@ -1,21 +1,18 @@
1
1
  <template>
2
- <Text :x="1" :y="3" :colorFg="'rgba(137,180,250,1)'" value="ScrollBox widget — scrollable container" />
2
+ <Text :x="1" :y="3" value="ScrollBox widget — scrollable container" />
3
3
 
4
4
  <ScrollBox
5
5
  :x="1"
6
6
  :y="4"
7
7
  :width="40"
8
8
  :height="8"
9
- :colorBg="'rgba(30,30,46,1)'"
10
- :borderColor="'rgba(137,180,250,0.5)'"
11
9
  borderStyle="rounded"
12
- :direction="'vertical'"
13
10
  :gap="1"
14
11
  :paddingTop="1"
15
12
  :paddingLeft="1"
16
13
  :alwaysShowScrollbar="true"
17
14
  >
18
- <Text v-for="item in items" :key="item" :colorFg="'rgba(205,214,244,1)'" :value="item" />
15
+ <Text v-for="item in items" :key="item" :value="item" />
19
16
  </ScrollBox>
20
17
 
21
18
  <Box
@@ -23,17 +20,15 @@
23
20
  :y="4"
24
21
  :width="30"
25
22
  :height="8"
26
- :colorBg="'rgba(30,30,46,1)'"
27
- :borderColor="'rgba(166,227,161,0.5)'"
28
23
  borderStyle="rounded"
29
- :direction="'vertical'"
24
+ direction="vertical"
30
25
  :gap="1"
31
26
  :paddingTop="1"
32
27
  :paddingLeft="1"
33
28
  >
34
- <Text :colorFg="'rgba(166,227,161,1)'" value="Scroll with arrow keys" />
35
- <Text :colorFg="'rgba(108,112,134,1)'" value="Content overflows the visible area" />
36
- <Text :colorFg="'rgba(108,112,134,1)'" value="Scrollbar appears automatically" />
29
+ <Text value="Scroll with arrow keys" />
30
+ <Text value="Content overflows the visible area" />
31
+ <Text value="Scrollbar appears automatically" />
37
32
  </Box>
38
33
  </template>
39
34
 
@@ -1,29 +1,27 @@
1
1
  <template>
2
- <Text :x="1" :y="3" :colorFg="'rgba(137,180,250,1)'" value="Select widget — dropdown selection" />
2
+ <Text :x="1" :y="3" value="Select widget — dropdown selection" />
3
3
 
4
4
  <Box
5
5
  :x="1"
6
6
  :y="4"
7
7
  :width="50"
8
- :height="5"
9
- :colorBg="'rgba(30,30,46,1)'"
10
- :borderColor="'rgba(137,180,250,0.5)'"
8
+ :height="8"
11
9
  borderStyle="rounded"
12
- :direction="'vertical'"
10
+ direction="vertical"
13
11
  :gap="1"
14
12
  :paddingTop="1"
15
13
  :paddingLeft="1"
16
14
  >
17
- <Text :colorFg="'rgba(108,112,134,1)'" value="Choose a framework:" />
15
+ <Text value="Choose a framework:" />
18
16
  <Select
19
17
  :width="46"
20
18
  :options="frameworks"
21
- :placeholder="'Select a framework...'"
19
+ placeholder="Select a framework..."
22
20
  @change="handleChange"
23
21
  />
24
22
  </Box>
25
23
 
26
- <Text :x="1" :y="10" :colorFg="'rgba(166,227,161,1)'" :value="selected" />
24
+ <Text :x="1" :y="13" :value="selected" />
27
25
  </template>
28
26
 
29
27
  <script setup lang="ts">
@@ -0,0 +1,19 @@
1
+ <template>
2
+ <Text :x="1" :y="3" value="Switch widget — on/off toggle" />
3
+
4
+ <Switch :x="1" :y="4" label="Dark mode" @change="handleChange('Dark mode', $event)" />
5
+ <Switch :x="1" :y="5" label="Notifications" @change="handleChange('Notifications', $event)" />
6
+ <Switch :x="1" :y="6" label="Disabled" :disabled="true" />
7
+
8
+ <Text :x="1" :y="8" :value="log" />
9
+ </template>
10
+
11
+ <script setup lang="ts">
12
+ import { ref } from '@vue/reactivity'
13
+
14
+ const log = ref('Toggle a switch above')
15
+
16
+ function handleChange(name: string, event: TuiSwitchChangeEvent) {
17
+ log.value = `${name}: ${event.checked ? 'on' : 'off'}`
18
+ }
19
+ </script>
@@ -1,19 +1,17 @@
1
1
  <template>
2
- <Text :x="1" :y="3" :colorFg="'rgba(137,180,250,1)'" value="Table widget — structured data display with selection" />
2
+ <Text :x="1" :y="3" value="Table widget — structured data display with selection" />
3
3
 
4
4
  <Table
5
5
  :x="1"
6
6
  :y="4"
7
7
  :width="60"
8
8
  :height="8"
9
- :colorBg="'rgba(30,30,46,1)'"
10
- :borderColor="'rgba(137,180,250,0.5)'"
11
9
  borderStyle="rounded"
12
10
  :columns="columns"
13
11
  :rows="rows"
14
12
  />
15
13
 
16
- <Text :x="1" :y="13" :colorFg="'rgba(108,112,134,1)'" value="Use arrow keys to navigate rows" />
14
+ <Text :x="1" :y="13" value="Use arrow keys to navigate rows" />
17
15
  </template>
18
16
 
19
17
  <script setup lang="ts">
@@ -0,0 +1,66 @@
1
+ <template>
2
+ <Text :x="1" :y="3" value="Text widget — display styled text" />
3
+
4
+ <Box
5
+ :x="1"
6
+ :y="4"
7
+ width="45%"
8
+ :height="8"
9
+ borderStyle="rounded"
10
+ direction="vertical"
11
+ :gap="1"
12
+ :paddingTop="1"
13
+ :paddingLeft="1"
14
+ >
15
+ <Text value="Font styles" />
16
+ <Text styleModifier="bold" value="Bold text" />
17
+ <Text styleModifier="italic" value="Italic text" />
18
+ </Box>
19
+
20
+ <Box
21
+ x="50%"
22
+ :y="4"
23
+ width="45%"
24
+ :height="10"
25
+ borderStyle="rounded"
26
+ direction="vertical"
27
+ :gap="1"
28
+ :paddingTop="1"
29
+ :paddingLeft="1"
30
+ >
31
+ <Text value="Colors" />
32
+ <Text colorFg="rgba(243,139,168,1)" value="Red " />
33
+ <Text colorFg="rgba(137,180,250,1)" value="Blue " />
34
+ <Text colorFg="rgba(166,227,161,1)" value="Green" />
35
+ </Box>
36
+
37
+ <Box
38
+ :x="1"
39
+ :y="15"
40
+ width="95%"
41
+ :height="6"
42
+ borderStyle="rounded"
43
+ direction="vertical"
44
+ :gap="1"
45
+ :paddingTop="1"
46
+ :paddingLeft="1"
47
+ >
48
+ <Text value="Dynamic clock:" />
49
+ <Text :value="clock" />
50
+ </Box>
51
+ </template>
52
+
53
+ <script setup lang="ts">
54
+ import { ref, computed } from '@vue/reactivity'
55
+
56
+ const elapsed = ref(0)
57
+ setInterval(() => {
58
+ elapsed.value += 1
59
+ }, 1000)
60
+
61
+ const clock = computed(() => {
62
+ elapsed.value
63
+ const now = new Date()
64
+ return now.toLocaleTimeString()
65
+ })
66
+ </script>
@@ -0,0 +1,38 @@
1
+ <template>
2
+ <Text :x="1" :y="3" value="Textarea widget — multi-line text editor" />
3
+
4
+ <Box
5
+ :x="1"
6
+ :y="4"
7
+ :width="50"
8
+ :height="8"
9
+ borderStyle="rounded"
10
+ direction="vertical"
11
+ :gap="1"
12
+ :paddingTop="1"
13
+ :paddingLeft="1"
14
+ >
15
+ <Text :value="label" />
16
+ <Textarea
17
+ :width="46"
18
+ :height="3"
19
+ placeholder="Enter multi-line text..."
20
+ v-model="text"
21
+ />
22
+ </Box>
23
+
24
+ <Text :x="1" :y="13" :value="preview" />
25
+ </template>
26
+
27
+ <script setup lang="ts">
28
+ import { ref, computed } from '@vue/reactivity'
29
+
30
+ const text = ref('')
31
+
32
+ const label = computed(() => text.value.length > 0 ? `Characters: ${text.value.length}` : 'Type something below:')
33
+
34
+ const preview = computed(() => {
35
+ const lines = text.value.split('\n')
36
+ return text.value.length > 0 ? `${lines.length} lines, ${text.value.length} chars` : 'Preview appears here'
37
+ })
38
+ </script>
@@ -0,0 +1,12 @@
1
+ import {runApp} from '../../shared/runApp.ts';
2
+ import App from './App.vue';
3
+
4
+ export const ENTRY = 'App.vue';
5
+
6
+ export function run(options?: {logFilePath?: string}) {
7
+ return runApp(App, options);
8
+ }
9
+
10
+ if (import.meta.main) {
11
+ run();
12
+ }
@@ -0,0 +1,14 @@
1
+ import {createApp, type TuiSFCModule} from '@buntui/core';
2
+
3
+ export function runApp(vueComponent: TuiSFCModule, options: {logFilePath?: string} = {}) {
4
+ const app = createApp({
5
+ logLevel: 'info',
6
+ clearLog: true,
7
+ tickRate: 60,
8
+ renderRate: 24,
9
+ ...options,
10
+ });
11
+ const scene = app.createScene(vueComponent, {bgHexRgb: 0x1A_1B_26, visible: true});
12
+ app.start();
13
+ return {app, scene};
14
+ }
@@ -22,7 +22,9 @@ The built output is in `dist/`.
22
22
 
23
23
  ```
24
24
  src/
25
- main.ts Production entry
26
- dev.ts Dev server with HMR
27
- App.vue Root SFC component
25
+ apps/main/ App entry point
26
+ App.vue Root SFC component
27
+ main.ts Production & dev entry
28
+ shared/
29
+ runApp.ts App bootstrap helper
28
30
  ```
@@ -3,17 +3,17 @@
3
3
  "version": "0.0.1",
4
4
  "type": "module",
5
5
  "scripts": {
6
- "dev": "bun --preload @buntui/compiler/vue-plugin src/dev.ts",
7
- "build": "bun run ./scripts/build.ts"
6
+ "dev": "buntui dev",
7
+ "build": "buntui build"
8
8
  },
9
9
  "dependencies": {
10
10
  "@buntui/core": "{{version}}",
11
- "@buntui/compiler": "{{version}}",
12
11
  "@buntui/native": "{{version}}",
13
12
  "@buntui/extensions": "{{version}}",
14
13
  "@vue/reactivity": "^3.5.34"
15
14
  },
16
15
  "devDependencies": {
16
+ "@buntui/cli": "{{version}}",
17
17
  "@types/bun": "latest",
18
18
  "vue": "^3.5.34",
19
19
  "vue-tsc": "^3.2.8"
@@ -0,0 +1,42 @@
1
+ <template>
2
+ <Box
3
+ x="20%"
4
+ y="25%"
5
+ width="60%"
6
+ :height="17"
7
+ borderStyle="rounded"
8
+ direction="vertical"
9
+ :gap="1"
10
+ align="center"
11
+ :paddingTop="1"
12
+ :paddingBottom="1"
13
+ :paddingLeft="2"
14
+ :paddingRight="2"
15
+ >
16
+ <Text :value="title" styleModifier="bold" />
17
+ <Text value="SFC template with hot reload" />
18
+ <Text value="Edit src/App.vue to get started" />
19
+ <Text :value="clock" />
20
+ <Box direction="horizontal" :gap="2" align="center">
21
+ <Button :value="'Count: ' + count" @click="increment" />
22
+ </Box>
23
+ </Box>
24
+ </template>
25
+
26
+ <script setup lang="ts">
27
+ import { onTick } from '@buntui/core'
28
+ import { ref } from '@vue/reactivity'
29
+
30
+ const title = '{{name}}'
31
+ const clock = ref('')
32
+ const count = ref(0)
33
+
34
+ onTick(() => {
35
+ const now = new Date()
36
+ clock.value = now.toLocaleTimeString()
37
+ })
38
+
39
+ function increment() {
40
+ count.value++
41
+ }
42
+ </script>
@@ -0,0 +1,12 @@
1
+ import {runApp} from '../../shared/runApp.ts';
2
+ import App from './App.vue';
3
+
4
+ export const ENTRY = 'App.vue';
5
+
6
+ export function run(options?: {logFilePath?: string}) {
7
+ return runApp(App, options);
8
+ }
9
+
10
+ if (import.meta.main) {
11
+ run();
12
+ }
@@ -0,0 +1,14 @@
1
+ import {createApp, type TuiSFCModule} from '@buntui/core';
2
+
3
+ export function runApp(vueComponent: TuiSFCModule, options: {logFilePath?: string} = {}) {
4
+ const app = createApp({
5
+ logLevel: 'info',
6
+ clearLog: true,
7
+ tickRate: 60,
8
+ renderRate: 24,
9
+ ...options,
10
+ });
11
+ const scene = app.createScene(vueComponent, {bgHexRgb: 0x1A_1B_26, visible: true});
12
+ app.start();
13
+ return {app, scene};
14
+ }
package/dist/buntui.so DELETED
Binary file