fragment-tools 0.2.5 → 0.2.7
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.
- package/README.md +1 -1
- package/package.json +6 -7
- package/src/cli/createConfig.js +4 -0
- package/src/cli/plugins/sketches.js +44 -0
- package/src/client/app/components/Init.svelte +1 -1
- package/src/client/app/modules/Params.svelte +2 -4
- package/src/client/app/renderers/FragmentRenderer.js +1 -1
- package/src/client/app/renderers/P5GLRenderer.js +3 -2
- package/src/client/app/renderers/P5Renderer.js +3 -2
- package/src/client/app/state/Sketch.svelte.js +11 -4
- package/src/client/app/state/rendering.svelte.js +6 -3
- package/src/client/app/state/sketches.svelte.js +4 -2
- package/src/client/app/ui/Field.svelte +2 -6
- package/src/client/app/ui/FieldSection.svelte +5 -2
- package/src/client/app/ui/FieldTrigger.svelte +3 -3
- package/src/client/app/ui/FieldTriggers.svelte +2 -4
- package/src/client/app/ui/ModuleRenderer.svelte +0 -1
- package/src/client/app/ui/SketchRenderer.svelte +8 -6
- package/src/client/app/ui/fields/ButtonInput.svelte +5 -5
- package/src/client/app/ui/fields/ColorInput.svelte +8 -2
- package/src/client/app/ui/fields/IntervalInput.svelte +6 -5
- package/src/client/app/ui/fields/ProgressInput.svelte +11 -4
- package/src/client/index.html +3 -3
- package/src/client/public/css/global.css +1 -1
- package/screenshot.png +0 -0
- package/src/client/public/icons/chevron-bottom.svg +0 -3
- package/src/client/public/icons/chevron-right.svg +0 -3
- package/src/client/public/icons/chevron-top.svg +0 -3
- package/src/client/public/icons/columns-horizontal.svg +0 -4
- package/src/client/public/icons/columns-vertical.svg +0 -4
- package/src/client/public/icons/folder-plus.svg +0 -6
- package/src/client/public/icons/lock.svg +0 -4
- package/src/client/public/icons/picture-in-picture.svg +0 -4
- package/src/client/public/icons/trash.svg +0 -5
- package/src/client/public/icons/trigger.svg +0 -8
- package/src/client/public/icons/unlock.svg +0 -4
package/README.md
CHANGED
|
@@ -87,7 +87,7 @@ export let update = ({ context, width, height }) => {
|
|
|
87
87
|
};
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
-
Learn how to write your own sketch by following the [Getting started](./docs
|
|
90
|
+
Learn how to write your own sketch by following the [Getting started](./docs/introduction/getting-started.md) guide, reading the [API docs](./docs/api/sketch.md) or the [examples](./examples/).
|
|
91
91
|
|
|
92
92
|
## Contributing
|
|
93
93
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fragment-tools",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "A web development environment for creative coding",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -21,20 +21,19 @@
|
|
|
21
21
|
},
|
|
22
22
|
"homepage": "https://github.com/raphaelameaume/fragment#readme",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@clack/core": "^0.
|
|
25
|
-
"@sveltejs/vite-plugin-svelte": "^
|
|
26
|
-
"body-parser": "^
|
|
24
|
+
"@clack/core": "^0.4.2",
|
|
25
|
+
"@sveltejs/vite-plugin-svelte": "^5.0.3",
|
|
26
|
+
"body-parser": "^2.2.0",
|
|
27
27
|
"changedpi": "^1.0.4",
|
|
28
|
-
"chokidar": "^3.5.2",
|
|
29
28
|
"convert-length": "^1.0.1",
|
|
30
|
-
"get-port": "^
|
|
29
|
+
"get-port": "^7.1.0",
|
|
31
30
|
"gifenc": "^1.0.3",
|
|
32
31
|
"glslify": "^7.1.1",
|
|
33
32
|
"is-unicode-supported": "^2.0.0",
|
|
34
33
|
"kleur": "^4.1.4",
|
|
35
34
|
"sade": "^1.7.4",
|
|
36
35
|
"svelte": "^5.19.0",
|
|
37
|
-
"vite": "^
|
|
36
|
+
"vite": "^6.3.5",
|
|
38
37
|
"webm-writer": "^1.0.0",
|
|
39
38
|
"ws": "^8.2.3"
|
|
40
39
|
},
|
package/src/cli/createConfig.js
CHANGED
|
@@ -6,6 +6,7 @@ import { svelte } from '@sveltejs/vite-plugin-svelte';
|
|
|
6
6
|
import checkDependencies from './plugins/check-dependencies.js';
|
|
7
7
|
import { file } from './utils.js';
|
|
8
8
|
import { log } from './log.js';
|
|
9
|
+
import sketches from './plugins/sketches.js';
|
|
9
10
|
|
|
10
11
|
export async function loadConfig({ cwd, filepath }) {
|
|
11
12
|
try {
|
|
@@ -58,6 +59,7 @@ export async function createConfig(
|
|
|
58
59
|
) {
|
|
59
60
|
const entriesPaths = entries.map((entry) => path.join(cwd, entry));
|
|
60
61
|
const root = file('../client');
|
|
62
|
+
const publicDir = path.join(cwd, 'public');
|
|
61
63
|
const app = path.join(root, 'app');
|
|
62
64
|
|
|
63
65
|
log.info(`Creating Vite configuration...`);
|
|
@@ -72,6 +74,7 @@ export async function createConfig(
|
|
|
72
74
|
configFile: false,
|
|
73
75
|
root,
|
|
74
76
|
logLevel: dev ? 'info' : 'silent',
|
|
77
|
+
publicDir,
|
|
75
78
|
resolve: {
|
|
76
79
|
alias: [
|
|
77
80
|
{
|
|
@@ -110,6 +113,7 @@ export async function createConfig(
|
|
|
110
113
|
entriesPaths,
|
|
111
114
|
build,
|
|
112
115
|
}),
|
|
116
|
+
sketches({ cwd, entries }),
|
|
113
117
|
],
|
|
114
118
|
define: {
|
|
115
119
|
__CWD__: `${JSON.stringify(cwd)}`,
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
|
|
3
|
+
export default function sketches({ cwd, entries }) {
|
|
4
|
+
const virtualModuleId = 'virtual:sketches';
|
|
5
|
+
const resolvedVirtualModuleId = '\0' + virtualModuleId;
|
|
6
|
+
|
|
7
|
+
return {
|
|
8
|
+
name: 'fragment-plugin-sketches',
|
|
9
|
+
resolveId(id) {
|
|
10
|
+
if (id === virtualModuleId) {
|
|
11
|
+
return resolvedVirtualModuleId;
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
load(id) {
|
|
15
|
+
if (id === resolvedVirtualModuleId) {
|
|
16
|
+
return `
|
|
17
|
+
export const sketches = {
|
|
18
|
+
${entries
|
|
19
|
+
.map((entry) => {
|
|
20
|
+
const entryPath = path.join(cwd, entry);
|
|
21
|
+
|
|
22
|
+
return `"${entry}": () => import("${entryPath}")`;
|
|
23
|
+
})
|
|
24
|
+
.join(',')}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const onSketchReload = (fn) => {
|
|
28
|
+
if (import.meta.hot) {
|
|
29
|
+
import.meta.hot.data.onSketchChange = fn;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
if (import.meta.hot) {
|
|
34
|
+
import.meta.hot.accept((m) => {
|
|
35
|
+
if (typeof import.meta.hot.data.onSketchChange === "function") {
|
|
36
|
+
import.meta.hot.data.onSketchChange(m);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
`;
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { assignSketchFiles } from '../triggers/shared.js';
|
|
3
3
|
import { sketchesManager } from '../state/sketches.svelte.js';
|
|
4
|
-
import { onSketchReload } from '
|
|
4
|
+
import { onSketchReload } from 'virtual:sketches';
|
|
5
5
|
import { getFilename } from '../utils/file.utils.js';
|
|
6
6
|
import '../utils/glslErrors.js';
|
|
7
7
|
|
|
@@ -139,8 +139,6 @@
|
|
|
139
139
|
disabled,
|
|
140
140
|
__initialValue: initialValue,
|
|
141
141
|
} = prop}
|
|
142
|
-
{@const isDisabled =
|
|
143
|
-
typeof disabled === 'function' ? disabled() : disabled}
|
|
144
142
|
{#if !hidden}
|
|
145
143
|
<Field
|
|
146
144
|
context={sketch.key}
|
|
@@ -150,9 +148,9 @@
|
|
|
150
148
|
{initialValue}
|
|
151
149
|
{type}
|
|
152
150
|
{index}
|
|
153
|
-
disabled
|
|
151
|
+
{disabled}
|
|
154
152
|
bind:params={sketchProps[key].params}
|
|
155
|
-
triggers={prop.triggers}
|
|
153
|
+
bind:triggers={prop.triggers}
|
|
156
154
|
onclick={(event) => {
|
|
157
155
|
sketch.version++;
|
|
158
156
|
// value(event, sketch.params);
|
|
@@ -36,10 +36,11 @@ let previews = [];
|
|
|
36
36
|
* @param {number} params.pixelRatio
|
|
37
37
|
* @returns {MountParamsP5GLRenderer}
|
|
38
38
|
*/
|
|
39
|
-
export let onMountPreview = ({ id, width, height }) => {
|
|
39
|
+
export let onMountPreview = ({ id, container, width, height }) => {
|
|
40
40
|
const p = new p5((sketch) => {
|
|
41
41
|
sketch.setup = () => {
|
|
42
|
-
sketch.createCanvas(width, height, 'webgl');
|
|
42
|
+
const canvas = sketch.createCanvas(width, height, 'webgl');
|
|
43
|
+
canvas.parent(container);
|
|
43
44
|
};
|
|
44
45
|
});
|
|
45
46
|
|
|
@@ -2,10 +2,11 @@ import p5 from 'p5';
|
|
|
2
2
|
|
|
3
3
|
let previews = [];
|
|
4
4
|
|
|
5
|
-
export let onMountPreview = ({ id, width, height }) => {
|
|
5
|
+
export let onMountPreview = ({ id, container, width, height }) => {
|
|
6
6
|
const p = new p5((sketch) => {
|
|
7
7
|
sketch.setup = () => {
|
|
8
|
-
sketch.createCanvas(width, height);
|
|
8
|
+
const canvas = sketch.createCanvas(width, height);
|
|
9
|
+
canvas.parent(container);
|
|
9
10
|
};
|
|
10
11
|
});
|
|
11
12
|
|
|
@@ -48,10 +48,7 @@ class Sketch {
|
|
|
48
48
|
|
|
49
49
|
reset() {
|
|
50
50
|
Object.keys(this.props).forEach((key) => {
|
|
51
|
-
this.updateProp(
|
|
52
|
-
key,
|
|
53
|
-
$state.snapshot(this.props[key].__initialValue),
|
|
54
|
-
);
|
|
51
|
+
this.updateProp(key, this.props[key].__initialValue);
|
|
55
52
|
});
|
|
56
53
|
|
|
57
54
|
this.propsFolders.forEach((fieldgroup) => {
|
|
@@ -199,6 +196,10 @@ class Sketch {
|
|
|
199
196
|
typeof instanceProp.hidden === 'function'
|
|
200
197
|
? instanceProp.hidden
|
|
201
198
|
: () => instanceProp.hidden;
|
|
199
|
+
let __disabled =
|
|
200
|
+
typeof instanceProp.disabled === 'function'
|
|
201
|
+
? instanceProp.disabled
|
|
202
|
+
: () => instanceProp.disabled;
|
|
202
203
|
|
|
203
204
|
let initialValue = deepClone(value);
|
|
204
205
|
|
|
@@ -215,6 +216,9 @@ class Sketch {
|
|
|
215
216
|
__initialValue: initialValue,
|
|
216
217
|
__currentValue: deepClone(value),
|
|
217
218
|
__hidden,
|
|
219
|
+
__disabled,
|
|
220
|
+
hidden: __hidden(),
|
|
221
|
+
disabled: __disabled(),
|
|
218
222
|
type,
|
|
219
223
|
params: structuredClone(params),
|
|
220
224
|
triggers,
|
|
@@ -256,6 +260,7 @@ class Sketch {
|
|
|
256
260
|
|
|
257
261
|
Object.keys(this.props).forEach((key) => {
|
|
258
262
|
this.props[key].hidden = this.props[key].__hidden();
|
|
263
|
+
this.props[key].disabled = this.props[key].__disabled();
|
|
259
264
|
});
|
|
260
265
|
|
|
261
266
|
this.version++;
|
|
@@ -438,6 +443,8 @@ class Sketch {
|
|
|
438
443
|
|
|
439
444
|
// sync hidden
|
|
440
445
|
prop.hidden = prop.__hidden();
|
|
446
|
+
// sync disabled state
|
|
447
|
+
prop.disabled = prop.__disabled();
|
|
441
448
|
|
|
442
449
|
// sync params
|
|
443
450
|
if (instanceProp.params) {
|
|
@@ -150,7 +150,7 @@ class Rendering {
|
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
findRenderer({ renderingMode }) {
|
|
153
|
-
return this.renderers[renderingMode]
|
|
153
|
+
return this.renderers[renderingMode]?.instance;
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
override(config) {
|
|
@@ -605,7 +605,7 @@ export class Render {
|
|
|
605
605
|
return;
|
|
606
606
|
}
|
|
607
607
|
|
|
608
|
-
this.record =
|
|
608
|
+
this.record = exports.record(this.canvas, {
|
|
609
609
|
filename: sketch.key,
|
|
610
610
|
pattern: sketch.filenamePattern,
|
|
611
611
|
exportDir: sketch.exportDir,
|
|
@@ -627,6 +627,8 @@ export class Render {
|
|
|
627
627
|
onComplete: (params) => {
|
|
628
628
|
sketch.afterRecord.forEach((fn) => fn(params));
|
|
629
629
|
this.record = null;
|
|
630
|
+
this.paused = false;
|
|
631
|
+
this.recording = false;
|
|
630
632
|
},
|
|
631
633
|
});
|
|
632
634
|
}
|
|
@@ -647,7 +649,8 @@ export class Render {
|
|
|
647
649
|
this.sketch.instance?.dispose?.();
|
|
648
650
|
this.sketch.reset();
|
|
649
651
|
|
|
650
|
-
this.
|
|
652
|
+
this.loading = false;
|
|
653
|
+
this.loaded = false;
|
|
651
654
|
} catch (error) {
|
|
652
655
|
console.error(error);
|
|
653
656
|
displayError(error, this.sketch.key);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { displayError } from '../state/errors.svelte.js';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import { sketches as all } from 'virtual:sketches';
|
|
4
|
+
|
|
3
5
|
import Sketch from './Sketch.svelte.js';
|
|
4
6
|
import { rendering } from './rendering.svelte.js';
|
|
5
7
|
import { removeHotListeners } from '../triggers/index.js';
|
|
@@ -15,7 +17,7 @@ class SketchesManager {
|
|
|
15
17
|
|
|
16
18
|
await rendering.preloadRenderer({
|
|
17
19
|
renderingMode: sketch.rendering,
|
|
18
|
-
|
|
20
|
+
customRenderer: sketch.renderer,
|
|
19
21
|
});
|
|
20
22
|
|
|
21
23
|
return sketch;
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
onchange,
|
|
53
53
|
onclick = () => {},
|
|
54
54
|
children,
|
|
55
|
-
triggers = [],
|
|
55
|
+
triggers = $bindable([]),
|
|
56
56
|
} = $props();
|
|
57
57
|
|
|
58
58
|
let showTriggers = $state(false);
|
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
{#if triggerable}
|
|
166
166
|
<FieldSection {key} visible={showTriggers} secondary>
|
|
167
167
|
<FieldTriggers
|
|
168
|
-
|
|
168
|
+
bind:triggers
|
|
169
169
|
{onTrigger}
|
|
170
170
|
{context}
|
|
171
171
|
triggerable={fieldType === fieldTypes.BUTTON}
|
|
@@ -222,10 +222,6 @@
|
|
|
222
222
|
padding-bottom: 0px !important;
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
.field.disabled {
|
|
226
|
-
pointer-events: none;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
225
|
.field__actions {
|
|
230
226
|
display: flex;
|
|
231
227
|
align-items: center;
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
class="field__section"
|
|
17
17
|
class:visible
|
|
18
18
|
class:secondary
|
|
19
|
+
class:disabled
|
|
19
20
|
class:nameless={displayName === null}
|
|
20
21
|
>
|
|
21
22
|
<div class="field__infos">
|
|
@@ -48,8 +49,10 @@
|
|
|
48
49
|
grid-template-columns: 1fr;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
|
-
:global(body:not(.fragment-dragging))
|
|
52
|
-
|
|
52
|
+
:global(body:not(.fragment-dragging))
|
|
53
|
+
.field__section:not(.disabled):hover
|
|
54
|
+
.field__label,
|
|
55
|
+
.field__section:not(.disabled):focus-within .field__label {
|
|
53
56
|
opacity: 1;
|
|
54
57
|
}
|
|
55
58
|
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
onchange = () => {},
|
|
52
52
|
onTrigger = () => {},
|
|
53
53
|
onDelete = () => {},
|
|
54
|
-
params = { key: [] },
|
|
54
|
+
params = $bindable({ key: [] }),
|
|
55
55
|
} = $props();
|
|
56
56
|
|
|
57
57
|
let validInputs = $derived.by(() =>
|
|
@@ -202,11 +202,11 @@
|
|
|
202
202
|
/>
|
|
203
203
|
{/if}
|
|
204
204
|
{#if inputType === 'Keyboard'}
|
|
205
|
-
<TextInput value={key} label="key" oninput={onTextChange} />
|
|
205
|
+
<TextInput bind:value={key} label="key" oninput={onTextChange} />
|
|
206
206
|
{/if}
|
|
207
207
|
{#if inputType === 'MIDI'}
|
|
208
208
|
<TextInput
|
|
209
|
-
value={key}
|
|
209
|
+
bind:value={key}
|
|
210
210
|
label={['onNoteOn', 'onNoteOff'].includes(eventName)
|
|
211
211
|
? 'note'
|
|
212
212
|
: 'number'}
|
|
@@ -31,17 +31,15 @@
|
|
|
31
31
|
{#each triggers as trigger, index}
|
|
32
32
|
<FieldTrigger
|
|
33
33
|
{index}
|
|
34
|
+
bind:triggers
|
|
34
35
|
inputType={trigger.inputType}
|
|
35
36
|
eventName={trigger.eventName}
|
|
36
|
-
params={trigger.params}
|
|
37
|
+
bind:params={trigger.params}
|
|
37
38
|
enabled={trigger.enabled}
|
|
38
39
|
{onTrigger}
|
|
39
40
|
{context}
|
|
40
41
|
{controllable}
|
|
41
42
|
{triggerable}
|
|
42
|
-
onchange={(index, trigger) => {
|
|
43
|
-
triggers[index] = trigger;
|
|
44
|
-
}}
|
|
45
43
|
onDelete={onTriggerDelete}
|
|
46
44
|
/>
|
|
47
45
|
{/each}
|
|
@@ -63,6 +63,14 @@
|
|
|
63
63
|
};
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
+
$effect(() => {
|
|
67
|
+
if (exports.recording && !render?.recording) {
|
|
68
|
+
render.startRecording();
|
|
69
|
+
} else if (render?.recording && !exports.recording) {
|
|
70
|
+
render.stopRecording();
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
|
|
66
74
|
function checkForRefresh(event) {
|
|
67
75
|
if (!event.metaKey && !event.ctrlKey) {
|
|
68
76
|
event.preventDefault();
|
|
@@ -97,12 +105,6 @@
|
|
|
97
105
|
function checkForRecord(event) {
|
|
98
106
|
if (event.shiftKey) {
|
|
99
107
|
exports.recording = !exports.recording;
|
|
100
|
-
|
|
101
|
-
if (exports.recording && !render.recording) {
|
|
102
|
-
render.startRecording();
|
|
103
|
-
} else if (render.recording && !exports.recording) {
|
|
104
|
-
render.stopRecording();
|
|
105
|
-
}
|
|
106
108
|
}
|
|
107
109
|
}
|
|
108
110
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
} = $props();
|
|
12
12
|
</script>
|
|
13
13
|
|
|
14
|
-
<div class="button-
|
|
14
|
+
<div class="button-input" class:disabled>
|
|
15
15
|
<button
|
|
16
16
|
class="button"
|
|
17
17
|
{disabled}
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
</div>
|
|
27
27
|
|
|
28
28
|
<style>
|
|
29
|
-
.button-
|
|
29
|
+
.button-input {
|
|
30
30
|
display: flex;
|
|
31
31
|
width: 100%;
|
|
32
32
|
}
|
|
@@ -57,15 +57,15 @@
|
|
|
57
57
|
color: var(--color-text-input-disabled);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
:global(body:not(.fragment-dragging)) .button:hover {
|
|
60
|
+
:global(body:not(.fragment-dragging)) .button:not(:disabled):hover {
|
|
61
61
|
color: var(--color-text);
|
|
62
62
|
|
|
63
63
|
box-shadow: inset 0 0 0 1px
|
|
64
64
|
var(--box-shadow-color-active, var(--color-active));
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
:global(body:not(.fragment-dragging)) .button:active,
|
|
68
|
-
:global(body:not(.fragment-dragging)) .button:focus-visible {
|
|
67
|
+
:global(body:not(.fragment-dragging)) .button:not(:disabled):active,
|
|
68
|
+
:global(body:not(.fragment-dragging)) .button:not(:disabled):focus-visible {
|
|
69
69
|
box-shadow: 0 0 0 2px
|
|
70
70
|
var(--box-shadow-color-active, var(--color-active));
|
|
71
71
|
}
|
|
@@ -217,7 +217,9 @@
|
|
|
217
217
|
pointer-events: none;
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
-
:global(body:not(.fragment-dragging))
|
|
220
|
+
:global(body:not(.fragment-dragging))
|
|
221
|
+
.color-input:not(.disabled)
|
|
222
|
+
.mirror:hover {
|
|
221
223
|
box-shadow: inset 0 0 0 1px var(--box-shadow-color, var(--color-active));
|
|
222
224
|
}
|
|
223
225
|
|
|
@@ -229,8 +231,12 @@
|
|
|
229
231
|
width: 100%;
|
|
230
232
|
height: 100%;
|
|
231
233
|
opacity: 0;
|
|
232
|
-
|
|
234
|
+
|
|
233
235
|
background: transparent;
|
|
234
236
|
border: none;
|
|
235
237
|
}
|
|
238
|
+
|
|
239
|
+
.color-input:not(.disabled) .input {
|
|
240
|
+
cursor: pointer;
|
|
241
|
+
}
|
|
236
242
|
</style>
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
value[0] = newValues[0];
|
|
82
82
|
value[1] = newValues[1];
|
|
83
83
|
|
|
84
|
-
onchange(
|
|
84
|
+
onchange(newValues);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
|
|
@@ -94,9 +94,10 @@
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
function handleValueChange(index, newValue) {
|
|
97
|
-
|
|
97
|
+
let newValues = [...value];
|
|
98
|
+
newValues[index] = newValue;
|
|
98
99
|
|
|
99
|
-
onchange(
|
|
100
|
+
onchange(newValues);
|
|
100
101
|
}
|
|
101
102
|
|
|
102
103
|
$effect(() => {
|
|
@@ -141,7 +142,7 @@
|
|
|
141
142
|
{max}
|
|
142
143
|
progress={false}
|
|
143
144
|
value={value[0]}
|
|
144
|
-
|
|
145
|
+
onchange={(event) => handleValueChange(0, event)}
|
|
145
146
|
/>
|
|
146
147
|
<NumberInput
|
|
147
148
|
{label}
|
|
@@ -154,7 +155,7 @@
|
|
|
154
155
|
{max}
|
|
155
156
|
progress={false}
|
|
156
157
|
value={value[1]}
|
|
157
|
-
|
|
158
|
+
onchange={(event) => handleValueChange(1, event)}
|
|
158
159
|
/>
|
|
159
160
|
</div>
|
|
160
161
|
</FieldInputRow>
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
// handlers
|
|
14
14
|
function handleMouseDown(event) {
|
|
15
|
+
if (disabled) return;
|
|
16
|
+
|
|
15
17
|
document.body.classList.add('fragment-dragging');
|
|
16
18
|
document.addEventListener('mousemove', handleMouseMove);
|
|
17
19
|
document.addEventListener('mouseup', handleMouseUp);
|
|
@@ -87,7 +89,7 @@
|
|
|
87
89
|
aria-valuemin={min}
|
|
88
90
|
aria-valuemax={max}
|
|
89
91
|
aria-valuenow={value}
|
|
90
|
-
tabindex=
|
|
92
|
+
tabindex={disabled ? -1 : 0}
|
|
91
93
|
>
|
|
92
94
|
<div
|
|
93
95
|
class="fill"
|
|
@@ -104,17 +106,22 @@
|
|
|
104
106
|
box-shadow: inset 0 0 0 1px var(--color-border-input);
|
|
105
107
|
|
|
106
108
|
background: var(--color-background-input);
|
|
107
|
-
|
|
109
|
+
|
|
108
110
|
container-type: size;
|
|
109
111
|
outline: 0;
|
|
110
112
|
}
|
|
111
113
|
|
|
112
|
-
:
|
|
114
|
+
.progress:not(.disabled) {
|
|
115
|
+
cursor: ew-resize;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
:global(body:not(.fragment-dragging)) .progress:not(.disabled):hover {
|
|
113
119
|
box-shadow: inset 0 0 0 1px var(--color-active);
|
|
114
120
|
}
|
|
115
121
|
|
|
116
122
|
.progress.dragging,
|
|
117
|
-
:global(body:not(.fragment-dragging))
|
|
123
|
+
:global(body:not(.fragment-dragging))
|
|
124
|
+
.progress:not(.disabled):focus-visible {
|
|
118
125
|
box-shadow: 0 0 0 2px var(--color-active);
|
|
119
126
|
}
|
|
120
127
|
|
package/src/client/index.html
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
|
-
<link rel="icon" href="/favicon.ico" />
|
|
5
|
+
<link rel="icon" href="./public/favicon.ico" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<link rel="stylesheet" href="/css/global.css" />
|
|
7
|
+
<link rel="stylesheet" href="./public/css/global.css" />
|
|
8
8
|
<title>fragment</title>
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
@@ -13,6 +13,6 @@
|
|
|
13
13
|
<span class="loading__step">▢ Loading dependencies...</span>
|
|
14
14
|
</div>
|
|
15
15
|
<div id="app"></div>
|
|
16
|
-
<script type="module" src="
|
|
16
|
+
<script type="module" src="./main.js"></script>
|
|
17
17
|
</body>
|
|
18
18
|
</html>
|
package/screenshot.png
DELETED
|
Binary file
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="24" fill="none" viewBox="0 0 24 24">
|
|
2
|
-
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M4.75 6.75C4.75 5.64543 5.64543 4.75 6.75 4.75H17.25C18.3546 4.75 19.25 5.64543 19.25 6.75V17.25C19.25 18.3546 18.3546 19.25 17.25 19.25H6.75C5.64543 19.25 4.75 18.3546 4.75 17.25V6.75Z"/>
|
|
3
|
-
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M19 12L5 12"/>
|
|
4
|
-
</svg>
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="24" fill="none" viewBox="0 0 24 24">
|
|
2
|
-
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M4.75 6.75C4.75 5.64543 5.64543 4.75 6.75 4.75H17.25C18.3546 4.75 19.25 5.64543 19.25 6.75V17.25C19.25 18.3546 18.3546 19.25 17.25 19.25H6.75C5.64543 19.25 4.75 18.3546 4.75 17.25V6.75Z"/>
|
|
3
|
-
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M12 5V19"/>
|
|
4
|
-
</svg>
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="24" fill="none" viewBox="0 0 24 24">
|
|
2
|
-
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M12.25 19.25H6.75C5.64543 19.25 4.75 18.3546 4.75 17.25V7.75H17.25C18.3546 7.75 19.25 8.64543 19.25 9.75V12.25"/>
|
|
3
|
-
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M13.5 7.5L12.5685 5.7923C12.2181 5.14977 11.5446 4.75 10.8127 4.75H6.75C5.64543 4.75 4.75 5.64543 4.75 6.75V11"/>
|
|
4
|
-
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M17 14.75V19.25"/>
|
|
5
|
-
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M19.25 17L14.75 17"/>
|
|
6
|
-
</svg>
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="24" fill="none" viewBox="0 0 24 24">
|
|
2
|
-
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M5.75 11.75C5.75 11.1977 6.19772 10.75 6.75 10.75H17.25C17.8023 10.75 18.25 11.1977 18.25 11.75V17.25C18.25 18.3546 17.3546 19.25 16.25 19.25H7.75C6.64543 19.25 5.75 18.3546 5.75 17.25V11.75Z"></path>
|
|
3
|
-
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M7.75 10.5V10.3427C7.75 8.78147 7.65607 7.04125 8.74646 5.9239C9.36829 5.2867 10.3745 4.75 12 4.75C13.6255 4.75 14.6317 5.2867 15.2535 5.9239C16.3439 7.04125 16.25 8.78147 16.25 10.3427V10.5"></path>
|
|
4
|
-
</svg>
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="24" fill="none" viewBox="0 0 24 24">
|
|
2
|
-
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M7.25 17.25H6.75C5.64543 17.25 4.75 16.3546 4.75 15.25V6.75C4.75 5.64543 5.64543 4.75 6.75 4.75H17.25C18.3546 4.75 19.25 5.64543 19.25 6.75V9.25"/>
|
|
3
|
-
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M10.75 13.75C10.75 13.1977 11.1977 12.75 11.75 12.75H18.25C18.8023 12.75 19.25 13.1977 19.25 13.75V18.25C19.25 18.8023 18.8023 19.25 18.25 19.25H11.75C11.1977 19.25 10.75 18.8023 10.75 18.25V13.75Z"/>
|
|
4
|
-
</svg>
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="24" fill="none" viewBox="0 0 24 24">
|
|
2
|
-
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M6.75 7.75L7.59115 17.4233C7.68102 18.4568 8.54622 19.25 9.58363 19.25H14.4164C15.4538 19.25 16.319 18.4568 16.4088 17.4233L17.25 7.75"/>
|
|
3
|
-
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M9.75 7.5V6.75C9.75 5.64543 10.6454 4.75 11.75 4.75H12.25C13.3546 4.75 14.25 5.64543 14.25 6.75V7.5"/>
|
|
4
|
-
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M5 7.75H19"/>
|
|
5
|
-
</svg>
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="24" fill="none" viewBox="0 0 24 24">
|
|
2
|
-
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M4.75 8H7.25"></path>
|
|
3
|
-
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M12.75 8H19.25"></path>
|
|
4
|
-
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M4.75 16H12.25"></path>
|
|
5
|
-
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M17.75 16H19.25"></path>
|
|
6
|
-
<circle cx="10" cy="8" r="2.25" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></circle>
|
|
7
|
-
<circle cx="15" cy="16" r="2.25" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></circle>
|
|
8
|
-
</svg>
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="24" fill="none" viewBox="0 0 24 24">
|
|
2
|
-
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M5.75 11.75C5.75 11.1977 6.19772 10.75 6.75 10.75H17.25C17.8023 10.75 18.25 11.1977 18.25 11.75V17.25C18.25 18.3546 17.3546 19.25 16.25 19.25H7.75C6.64543 19.25 5.75 18.3546 5.75 17.25V11.75Z"></path>
|
|
3
|
-
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M7.75 10.5V9.84343C7.75 8.61493 7.70093 7.29883 8.42416 6.30578C8.99862 5.51699 10.0568 4.75 12 4.75C14 4.75 15.25 6.25 15.25 6.25"></path>
|
|
4
|
-
</svg>
|