fragment-tools 0.1.13 → 0.1.15

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 (184) hide show
  1. package/.prettierignore +1 -2
  2. package/.prettierrc +23 -7
  3. package/README.md +28 -9
  4. package/bin/index.js +70 -10
  5. package/package.json +14 -6
  6. package/src/cli/build.js +125 -0
  7. package/src/cli/create.js +238 -0
  8. package/src/cli/createConfig.js +82 -0
  9. package/src/cli/createFragmentFile.js +70 -0
  10. package/src/cli/getEntries.js +85 -0
  11. package/src/cli/log.js +36 -24
  12. package/src/cli/plugins/check-dependencies.js +88 -42
  13. package/src/cli/plugins/hot-shader-replacement.js +408 -0
  14. package/src/cli/plugins/hot-sketch-reload.js +21 -25
  15. package/src/cli/plugins/save.js +101 -0
  16. package/src/cli/preview.js +55 -0
  17. package/src/cli/prompts.js +260 -0
  18. package/src/cli/run.js +131 -0
  19. package/src/cli/templates/blank/index.js +33 -0
  20. package/src/cli/templates/blank/meta.json +4 -0
  21. package/src/cli/templates/default/index.js +39 -0
  22. package/src/cli/templates/default/meta.json +5 -0
  23. package/src/cli/templates/fragment-gl/index.js +37 -0
  24. package/src/cli/templates/fragment-gl/meta.json +4 -0
  25. package/src/cli/templates/p5/index.js +32 -0
  26. package/src/cli/templates/p5/meta.json +5 -0
  27. package/src/cli/templates/p5-webgl/fragment.fs +14 -0
  28. package/src/cli/templates/p5-webgl/index.js +67 -0
  29. package/src/cli/templates/p5-webgl/meta.json +5 -0
  30. package/src/cli/templates/three-fragment/fragment.fs +10 -0
  31. package/src/cli/templates/three-fragment/index.js +95 -0
  32. package/src/cli/templates/three-fragment/meta.json +5 -0
  33. package/src/cli/templates/three-orthographic/index.js +55 -0
  34. package/src/cli/templates/three-orthographic/meta.json +5 -0
  35. package/src/cli/templates/three-perspective/index.js +52 -0
  36. package/src/cli/templates/three-perspective/meta.json +5 -0
  37. package/src/cli/utils.js +70 -0
  38. package/src/cli/ws.js +87 -78
  39. package/src/client/app/App.svelte +3 -3
  40. package/src/client/app/client.js +55 -39
  41. package/src/client/app/components/IconCross.svelte +18 -18
  42. package/src/client/app/components/Init.svelte +40 -8
  43. package/src/client/app/components/KeyBinding.svelte +22 -22
  44. package/src/client/app/helpers.js +42 -0
  45. package/src/client/app/hooks.js +20 -0
  46. package/src/client/app/inputs/Input.js +9 -9
  47. package/src/client/app/inputs/Keyboard.js +13 -15
  48. package/src/client/app/inputs/MIDI.js +14 -15
  49. package/src/client/app/inputs/Mouse.js +1 -1
  50. package/src/client/app/inputs/Webcam.js +89 -88
  51. package/src/client/app/lib/canvas-recorder/CanvasRecorder.js +41 -21
  52. package/src/client/app/lib/canvas-recorder/FrameRecorder.js +7 -6
  53. package/src/client/app/lib/canvas-recorder/H264Recorder.js +45 -0
  54. package/src/client/app/lib/canvas-recorder/MP4Recorder.js +7 -9
  55. package/src/client/app/lib/canvas-recorder/WebMRecorder.js +3 -4
  56. package/src/client/app/lib/canvas-recorder/mp4.js +1649 -15
  57. package/src/client/app/lib/canvas-recorder/utils.js +33 -17
  58. package/src/client/app/lib/gl/Geometry.js +11 -8
  59. package/src/client/app/lib/gl/Program.js +38 -19
  60. package/src/client/app/lib/gl/Renderer.js +163 -156
  61. package/src/client/app/lib/gl/Texture.js +113 -85
  62. package/src/client/app/lib/gl/index.js +12 -12
  63. package/src/client/app/lib/gl/utils.js +1 -3
  64. package/src/client/app/lib/helpers/frameDebounce.js +30 -30
  65. package/src/client/app/lib/loader/index.js +10 -10
  66. package/src/client/app/lib/loader/loadImage.js +15 -15
  67. package/src/client/app/lib/loader/loadScript.js +1 -1
  68. package/src/client/app/lib/paper-sizes.js +75 -76
  69. package/src/client/app/lib/presets.js +25 -5
  70. package/src/client/app/lib/tempo/Analyser.js +18 -17
  71. package/src/client/app/lib/tempo/Range.js +15 -12
  72. package/src/client/app/lib/tempo/index.js +34 -27
  73. package/src/client/app/modules/AudioAnalyser/Range.svelte +69 -72
  74. package/src/client/app/modules/AudioAnalyser/Spectrum.svelte +20 -19
  75. package/src/client/app/modules/AudioAnalyser.svelte +52 -35
  76. package/src/client/app/modules/Console/ConsoleLine.svelte +193 -172
  77. package/src/client/app/modules/Console.svelte +76 -74
  78. package/src/client/app/modules/Exports.svelte +62 -43
  79. package/src/client/app/modules/MidiPanel.svelte +100 -101
  80. package/src/client/app/modules/Monitor.svelte +57 -57
  81. package/src/client/app/modules/Params.svelte +128 -103
  82. package/src/client/app/renderers/2DRenderer.js +3 -3
  83. package/src/client/app/renderers/FragmentRenderer.js +30 -23
  84. package/src/client/app/renderers/P5GLRenderer.js +144 -0
  85. package/src/client/app/renderers/P5Renderer.js +10 -7
  86. package/src/client/app/renderers/THREERenderer.js +136 -94
  87. package/src/client/app/stores/audioAnalysis.js +3 -4
  88. package/src/client/app/stores/console.js +9 -10
  89. package/src/client/app/stores/errors.js +1 -1
  90. package/src/client/app/stores/exports.js +36 -20
  91. package/src/client/app/stores/index.js +2 -2
  92. package/src/client/app/stores/layout.js +143 -138
  93. package/src/client/app/stores/multisampling.js +4 -4
  94. package/src/client/app/stores/props.js +76 -13
  95. package/src/client/app/stores/renderers.js +26 -15
  96. package/src/client/app/stores/rendering.js +108 -89
  97. package/src/client/app/stores/sketches.js +7 -9
  98. package/src/client/app/stores/time.js +18 -18
  99. package/src/client/app/stores/utils.js +95 -38
  100. package/src/client/app/transitions/fade.js +3 -3
  101. package/src/client/app/transitions/index.js +6 -7
  102. package/src/client/app/transitions/splitX.js +2 -2
  103. package/src/client/app/transitions/splitY.js +2 -2
  104. package/src/client/app/triggers/Keyboard.js +88 -79
  105. package/src/client/app/triggers/MIDI.js +110 -84
  106. package/src/client/app/triggers/Mouse.js +73 -65
  107. package/src/client/app/triggers/Trigger.js +59 -58
  108. package/src/client/app/triggers/index.js +7 -7
  109. package/src/client/app/triggers/shared.js +5 -5
  110. package/src/client/app/ui/Build.svelte +70 -71
  111. package/src/client/app/ui/ErrorOverlay.svelte +118 -104
  112. package/src/client/app/ui/Field.svelte +393 -258
  113. package/src/client/app/ui/FieldGroup.svelte +106 -94
  114. package/src/client/app/ui/FieldSection.svelte +127 -116
  115. package/src/client/app/ui/FieldSpace.svelte +29 -30
  116. package/src/client/app/ui/FieldTrigger.svelte +256 -244
  117. package/src/client/app/ui/FieldTriggers.svelte +46 -46
  118. package/src/client/app/ui/FloatingParams.svelte +29 -30
  119. package/src/client/app/ui/Layout.svelte +31 -32
  120. package/src/client/app/ui/LayoutColumn.svelte +4 -4
  121. package/src/client/app/ui/LayoutComponent.svelte +239 -225
  122. package/src/client/app/ui/LayoutResizer.svelte +195 -176
  123. package/src/client/app/ui/LayoutRoot.svelte +6 -6
  124. package/src/client/app/ui/LayoutRow.svelte +4 -4
  125. package/src/client/app/ui/LayoutToolbar.svelte +191 -194
  126. package/src/client/app/ui/Module.svelte +134 -135
  127. package/src/client/app/ui/ModuleHeaderAction.svelte +81 -78
  128. package/src/client/app/ui/ModuleHeaderButton.svelte +12 -12
  129. package/src/client/app/ui/ModuleHeaderSelect.svelte +47 -37
  130. package/src/client/app/ui/ModuleRenderer.svelte +26 -27
  131. package/src/client/app/ui/OutputRenderer.svelte +112 -105
  132. package/src/client/app/ui/ParamsMultisampling.svelte +96 -95
  133. package/src/client/app/ui/ParamsOutput.svelte +130 -113
  134. package/src/client/app/ui/Preview.svelte +7 -8
  135. package/src/client/app/ui/SelectChevrons.svelte +27 -15
  136. package/src/client/app/ui/SketchRenderer.svelte +780 -667
  137. package/src/client/app/ui/SketchSelect.svelte +50 -44
  138. package/src/client/app/ui/fields/ButtonInput.svelte +61 -48
  139. package/src/client/app/ui/fields/CheckboxInput.svelte +67 -61
  140. package/src/client/app/ui/fields/ColorInput.svelte +294 -238
  141. package/src/client/app/ui/fields/FieldInputRow.svelte +8 -8
  142. package/src/client/app/ui/fields/ImageInput.svelte +123 -121
  143. package/src/client/app/ui/fields/Input.svelte +100 -111
  144. package/src/client/app/ui/fields/IntervalInput.svelte +268 -0
  145. package/src/client/app/ui/fields/ListInput.svelte +96 -96
  146. package/src/client/app/ui/fields/NumberInput.svelte +120 -116
  147. package/src/client/app/ui/fields/ProgressInput.svelte +99 -73
  148. package/src/client/app/ui/fields/Select.svelte +137 -124
  149. package/src/client/app/ui/fields/TextInput.svelte +10 -11
  150. package/src/client/app/ui/fields/VectorInput.svelte +86 -82
  151. package/src/client/app/utils/canvas.utils.js +189 -208
  152. package/src/client/app/utils/color.utils.js +138 -101
  153. package/src/client/app/utils/fields.utils.js +131 -0
  154. package/src/client/app/utils/file.utils.js +209 -37
  155. package/src/client/app/utils/glsl.utils.js +2 -2
  156. package/src/client/app/utils/glslErrors.js +49 -31
  157. package/src/client/app/utils/index.js +32 -29
  158. package/src/client/app/utils/math.utils.js +14 -10
  159. package/src/client/index.html +16 -16
  160. package/src/client/main.js +4 -4
  161. package/src/client/public/css/global.css +26 -16
  162. package/src/cli/db.js +0 -17
  163. package/src/cli/index.js +0 -198
  164. package/src/cli/plugins/db.js +0 -12
  165. package/src/cli/plugins/hot-shader-reload.js +0 -86
  166. package/src/cli/plugins/screenshot.js +0 -46
  167. package/src/cli/server.js +0 -153
  168. package/src/cli/templates/2d.js +0 -15
  169. package/src/cli/templates/blank.js +0 -13
  170. package/src/cli/templates/fragment.js +0 -18
  171. package/src/cli/templates/index.js +0 -27
  172. package/src/cli/templates/p5.js +0 -13
  173. package/src/cli/templates/three-fragment.js +0 -53
  174. package/src/cli/templates/three-orthographic.js +0 -23
  175. package/src/cli/templates/three-perspective.js +0 -20
  176. package/src/client/app/lib/canvas-recorder/FFMPEGRecorder.js +0 -56
  177. package/src/client/app/utils/props.utils.js +0 -51
  178. package/src/client/public/fonts/Inter-Bold.woff2 +0 -0
  179. package/src/client/public/fonts/Inter-Italic.woff2 +0 -0
  180. package/src/client/public/fonts/Inter-Regular.woff2 +0 -0
  181. package/src/client/public/fonts/Inter-SemiBold.woff2 +0 -0
  182. package/src/client/public/js/ffmpeg.min.js +0 -2
  183. package/src/client/public/js/ffmpeg.min.js.map +0 -1
  184. /package/src/cli/templates/{fragment.fs → fragment-gl/fragment.fs} +0 -0
@@ -1,279 +1,293 @@
1
1
  <script context="module">
2
- let ID = 0;
2
+ let ID = 0;
3
3
  </script>
4
4
 
5
5
  <script>
6
- import { getContext, hasContext, onDestroy, setContext } from "svelte";
7
- import { writable } from "svelte/store";
8
- import { addChildren, addSibling, layout, remove, replaceChildren, swapRoot, updateModule } from "../stores/layout";
9
- import Toolbar from "./LayoutToolbar.svelte";
10
- import Resizer from "./LayoutResizer.svelte";
11
- import { getModuleID } from "./Module.svelte";
12
- import ModuleRenderer from "./ModuleRenderer.svelte";
13
- import Preview from "./Preview.svelte";
14
-
15
- export let size = 1;
16
- export let type = "column";
17
- export let tree = { children: [] };
18
-
19
- let parent = hasContext('parent') ? getContext('parent') : null;
20
- let depth = hasContext('depth') ? (getContext('depth') + 1) : 0;
21
- let module = writable({});
22
- setContext('depth', depth);
23
- setContext('module', module);
24
-
25
- let isRoot = parent === null;
26
- let children = writable([]);
27
- let style = "";
28
-
29
- function createComponent({
30
- id,
31
- parent = null,
32
- root = false,
33
- node = null,
34
- depth,
35
- size = 1,
36
- minimized = false,
37
- type,
38
- children = [],
39
- }) {
40
- return {
6
+ import { getContext, hasContext, onDestroy, setContext } from 'svelte';
7
+ import { writable } from 'svelte/store';
8
+ import {
9
+ addChildren,
10
+ addSibling,
11
+ layout,
12
+ remove,
13
+ replaceChildren,
14
+ swapRoot,
15
+ updateModule,
16
+ } from '../stores/layout';
17
+ import Toolbar from './LayoutToolbar.svelte';
18
+ import Resizer from './LayoutResizer.svelte';
19
+ import { getModuleID } from './Module.svelte';
20
+ import ModuleRenderer from './ModuleRenderer.svelte';
21
+ import Preview from './Preview.svelte';
22
+
23
+ export let size = 1;
24
+ export let type = 'column';
25
+ export let tree = { children: [] };
26
+
27
+ let parent = hasContext('parent') ? getContext('parent') : null;
28
+ let depth = hasContext('depth') ? getContext('depth') + 1 : 0;
29
+ let module = writable({});
30
+ setContext('depth', depth);
31
+ setContext('module', module);
32
+
33
+ let isRoot = parent === null;
34
+ let children = writable([]);
35
+ let style = '';
36
+
37
+ function createComponent({
41
38
  id,
42
- root,
43
- node,
39
+ parent = null,
40
+ root = false,
41
+ node = null,
44
42
  depth,
45
- size,
46
- minimized,
47
- parent: parent ? parent.id : null,
43
+ size = 1,
44
+ minimized = false,
48
45
  type,
49
- children,
50
- };
51
- }
52
-
53
- let current = createComponent({
54
- id: !isNaN(tree.id) ? tree.id : ID++,
55
- root: isRoot,
56
- depth,
57
- size,
58
- parent,
59
- type,
60
- });
61
-
62
- ID = Math.max(ID, !isNaN(current.id) ? current.id + 1 : 0);
63
-
64
- $: isColumn = type === "column";
65
- $: isRow = !isColumn;
66
-
67
- const context = {
68
- id: current.id,
69
- children,
70
- registerChild: (child) => {
71
- $children = [...$children, child];
72
-
73
- onDestroy(() => {
74
- $children = $children.filter((c) => c !== child);
75
- });
46
+ children = [],
47
+ }) {
48
+ return {
49
+ id,
50
+ root,
51
+ node,
52
+ depth,
53
+ size,
54
+ minimized,
55
+ parent: parent ? parent.id : null,
56
+ type,
57
+ children,
58
+ };
76
59
  }
77
- };
78
60
 
79
- setContext('parent', context);
61
+ let current = createComponent({
62
+ id: !isNaN(tree.id) ? tree.id : ID++,
63
+ root: isRoot,
64
+ depth,
65
+ size,
66
+ parent,
67
+ type,
68
+ });
80
69
 
81
- if (parent) {
82
- parent.registerChild(current);
83
- }
70
+ ID = Math.max(ID, !isNaN(current.id) ? current.id + 1 : 0);
84
71
 
85
- if (!__BUILD__) {
86
- $layout.registerChild(current, () => $children);
87
- }
72
+ $: isColumn = type === 'column';
73
+ $: isRow = !isColumn;
88
74
 
89
- $: {
90
- let property = ``, value = ``;
75
+ const context = {
76
+ id: current.id,
77
+ children,
78
+ registerChild: (child) => {
79
+ $children = [...$children, child];
91
80
 
92
- const nodes = tree.children;
81
+ onDestroy(() => {
82
+ $children = $children.filter((c) => c !== child);
83
+ });
84
+ },
85
+ };
93
86
 
94
- if (Array.isArray(nodes) && nodes.length > 1) {
95
- if (isColumn) {
96
- property = `grid-template-rows`;
97
- value = nodes.map((row, i) => {
98
- let size = `${row.size}fr`;
87
+ setContext('parent', context);
99
88
 
100
- return `minmax(25px, ${size}) 0px`;
101
- }).join(' ');
102
- } else {
103
- property = `grid-template-columns`;
104
- value = nodes.map((col, i) => {
105
- let size = `${col.size}fr`;
89
+ if (parent) {
90
+ parent.registerChild(current);
91
+ }
106
92
 
107
- return `minmax(25px, ${size}) 0px`;
108
- }).join(' ');
109
- }
93
+ if (!__BUILD__) {
94
+ $layout.registerChild(current, () => $children);
95
+ }
110
96
 
111
- style = `${property}:${value}`;
112
- } else {
113
- style = "";
97
+ $: {
98
+ let property = ``,
99
+ value = ``;
100
+
101
+ const nodes = tree.children;
102
+
103
+ if (Array.isArray(nodes) && nodes.length > 1) {
104
+ if (isColumn) {
105
+ property = `grid-template-rows`;
106
+ value = nodes
107
+ .map((row, i) => {
108
+ let size = `${row.size}fr`;
109
+
110
+ return `minmax(25px, ${size}) 0px`;
111
+ })
112
+ .join(' ');
113
+ } else {
114
+ property = `grid-template-columns`;
115
+ value = nodes
116
+ .map((col, i) => {
117
+ let size = `${col.size}fr`;
118
+
119
+ return `minmax(25px, ${size}) 0px`;
120
+ })
121
+ .join(' ');
122
+ }
123
+
124
+ style = `${property}:${value}`;
125
+ } else {
126
+ style = '';
127
+ }
114
128
  }
115
- }
116
-
117
- function addComponent(newType) {
118
- const isSibling = newType === type;
119
-
120
- const newborn = createComponent({
121
- id: ID++,
122
- parent: isSibling ? parent : context,
123
- depth: isSibling ? depth : depth + 1,
124
- type: newType,
125
- children: [
126
- { mID: getModuleID(), type: "module" },
127
- ]
128
- });
129
129
 
130
- if (isSibling) {
131
- if (isRoot) {
132
- const newSibling = createComponent({
133
- id: ID++,
134
- depth: newborn.depth,
135
- type: newborn.type,
136
- children: current.children,
137
- });
130
+ function addComponent(newType) {
131
+ const isSibling = newType === type;
138
132
 
139
- // switch type
140
- current.children = [
141
- newSibling,
142
- newborn,
143
- ];
144
- current.type = current.type === "column" ? "row" : "column";
133
+ const newborn = createComponent({
134
+ id: ID++,
135
+ parent: isSibling ? parent : context,
136
+ depth: isSibling ? depth : depth + 1,
137
+ type: newType,
138
+ children: [{ mID: getModuleID(), type: 'module' }],
139
+ });
145
140
 
146
- swapRoot(current);
147
- } else {
148
- addSibling(current, newborn);
149
- }
150
- } else {
151
- if ($children.length === 1 && $children[0].type === "module") {
152
- replaceChildren(current, [
153
- ...$children.map((c, i) => createComponent({
141
+ if (isSibling) {
142
+ if (isRoot) {
143
+ const newSibling = createComponent({
154
144
  id: ID++,
155
- type: type === "row" ? "column" : "row",
156
- depth: depth + 1,
157
- children: [
158
- c,
159
- ]
160
- })),
161
- newborn
162
- ]);
163
-
164
- module.set({});
145
+ depth: newborn.depth,
146
+ type: newborn.type,
147
+ children: current.children,
148
+ });
149
+
150
+ // switch type
151
+ current.children = [newSibling, newborn];
152
+ current.type = current.type === 'column' ? 'row' : 'column';
153
+
154
+ swapRoot(current);
155
+ } else {
156
+ addSibling(current, newborn);
157
+ }
165
158
  } else {
166
- addChildren(current, newborn);
159
+ if ($children.length === 1 && $children[0].type === 'module') {
160
+ replaceChildren(current, [
161
+ ...$children.map((c, i) =>
162
+ createComponent({
163
+ id: ID++,
164
+ type: type === 'row' ? 'column' : 'row',
165
+ depth: depth + 1,
166
+ children: [c],
167
+ }),
168
+ ),
169
+ newborn,
170
+ ]);
171
+
172
+ module.set({});
173
+ } else {
174
+ addChildren(current, newborn);
175
+ }
167
176
  }
168
177
  }
169
- }
170
-
171
- function addColumn() {
172
- addComponent('column');
173
- }
174
178
 
175
- function addRow() {
176
- addComponent("row");
177
- }
179
+ function addColumn() {
180
+ addComponent('column');
181
+ }
178
182
 
179
- function deleteCurrent() {
180
- remove(current);
183
+ function addRow() {
184
+ addComponent('row');
185
+ }
181
186
 
182
- $children = current.children;
183
- }
187
+ function deleteCurrent() {
188
+ remove(current);
184
189
 
185
- function handleModuleChange(event) {
186
- const moduleName = event.detail;
187
- $children[0].name = moduleName; // keep state when replacingChildren
190
+ $children = current.children;
191
+ }
188
192
 
189
- updateModule($module, {
190
- name: moduleName,
191
- });
192
- }
193
+ function handleModuleChange(event) {
194
+ const moduleName = event.detail;
195
+ $children[0].name = moduleName; // keep state when replacingChildren
193
196
 
194
- let offsetWidth;
197
+ updateModule($module, {
198
+ name: moduleName,
199
+ });
200
+ }
195
201
 
196
- $: minimized = current.minimized;
202
+ let offsetWidth;
197
203
 
204
+ $: minimized = current.minimized;
198
205
  </script>
199
206
 
200
207
  <div
201
- style={style}
208
+ {style}
202
209
  class:column={isColumn}
203
210
  class:root={isRoot}
204
211
  class:row={isRow}
205
- class:minimized={minimized}
212
+ class:minimized
206
213
  bind:this={current.node}
207
- bind:offsetWidth={offsetWidth}
214
+ bind:offsetWidth
208
215
  >
209
216
  {#if isRoot && $layout.previewing}
210
217
  <Preview />
211
- {:else if tree && Array.isArray(tree.children) && tree.children.length > 0 }
212
- {#each tree.children as child (child.id) }
213
- {#if child.type === "column" || child.type === "row"}
218
+ {:else if tree && Array.isArray(tree.children) && tree.children.length > 0}
219
+ {#each tree.children as child (child.id)}
220
+ {#if child.type === 'column' || child.type === 'row'}
214
221
  <svelte:self type={child.type} size={child.size} tree={child} />
215
- {:else if child.type === "module"}
216
- <ModuleRenderer name={child.name} mID={child.mID} hasHeader={child.hasHeader} />
222
+ {:else if child.type === 'module'}
223
+ <ModuleRenderer
224
+ name={child.name}
225
+ mID={child.mID}
226
+ hasHeader={child.hasHeader}
227
+ />
217
228
  {/if}
218
229
  {/each}
219
230
  {:else}
220
- <slot></slot>
231
+ <slot />
221
232
  {/if}
222
- {#if $layout.editing && (($children.length === 1 && $children[0].type === "module") || isRoot) }
223
- <Toolbar
224
- {isRoot}
225
- moduleName={$children[0].name}
226
- on:change={handleModuleChange}
227
- on:add-row={addRow}
228
- on:add-column={addColumn}
229
- on:delete={deleteCurrent}
230
- vertical={offsetWidth < 300}
231
- />
233
+ {#if $layout.editing && (($children.length === 1 && $children[0].type === 'module') || isRoot)}
234
+ <Toolbar
235
+ {isRoot}
236
+ moduleName={$children[0].name}
237
+ on:change={handleModuleChange}
238
+ on:add-row={addRow}
239
+ on:add-column={addColumn}
240
+ on:delete={deleteCurrent}
241
+ vertical={offsetWidth < 300}
242
+ />
232
243
  {/if}
233
244
  </div>
234
- {#if !isRoot }
235
- <Resizer direction={isColumn ? "vertical" : "horizontal"} {current} {parent} />
245
+ {#if !isRoot}
246
+ <Resizer
247
+ direction={isColumn ? 'vertical' : 'horizontal'}
248
+ {current}
249
+ {parent}
250
+ />
236
251
  {/if}
237
252
 
238
-
239
253
  <style>
240
- .root {
241
- align-content: stretch;
242
- width: 100%;
243
- height: 100%;
244
- }
245
-
246
- .column {
247
- position: relative;
248
- display: grid;
249
- grid-template-columns: 1fr;
250
- grid-template-rows: minmax(25px, 1fr);
251
- }
252
-
253
- .column:not(:last-child) {
254
- border-right: 0.5px solid var(--color-lightblack);
255
- }
256
-
257
- .column:not(:first-child) {
258
- border-left: 0.5px solid var(--color-lightblack);
259
- }
260
-
261
- .row {
262
- position: relative;
263
- display: grid;
264
- grid-template-columns: 1fr;
265
- grid-template-rows: minmax(25px, 1fr);
266
- width: 100%;
267
- height: 100%;
268
-
269
- background-color: var(--color-background);
270
- }
271
-
272
- .row:not(:first-child) {
273
- border-top: 0.5px solid var(--color-lightblack);
274
- }
275
-
276
- .row:not(:last-child) {
277
- border-bottom: 0.5px solid var(--color-lightblack);
278
- }
254
+ .root {
255
+ align-content: stretch;
256
+ width: 100%;
257
+ height: 100%;
258
+ }
259
+
260
+ .column {
261
+ position: relative;
262
+ display: grid;
263
+ grid-template-columns: 1fr;
264
+ grid-template-rows: minmax(25px, 1fr);
265
+ }
266
+
267
+ .column:not(:last-child) {
268
+ border-right: 0.5px solid var(--color-lightblack);
269
+ }
270
+
271
+ .column:not(:first-child) {
272
+ border-left: 0.5px solid var(--color-lightblack);
273
+ }
274
+
275
+ .row {
276
+ position: relative;
277
+ display: grid;
278
+ grid-template-columns: 1fr;
279
+ grid-template-rows: minmax(25px, 1fr);
280
+ width: 100%;
281
+ height: 100%;
282
+
283
+ background-color: var(--color-background);
284
+ }
285
+
286
+ .row:not(:first-child) {
287
+ border-top: 0.5px solid var(--color-lightblack);
288
+ }
289
+
290
+ .row:not(:last-child) {
291
+ border-bottom: 0.5px solid var(--color-lightblack);
292
+ }
279
293
  </style>