@3sln/deck 0.0.9 → 0.0.10
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/package.json +2 -2
- package/src/deck-demo.js +20 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@3sln/deck",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "A Vite plugin for building scalable, zero-config, Markdown-based component playgrounds and documentation sites.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Ray Stubbs",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@3sln/bones": "^0.0.4",
|
|
40
|
-
"@3sln/dodo": "^0.0.
|
|
40
|
+
"@3sln/dodo": "^0.0.7",
|
|
41
41
|
"@3sln/ngin": "^0.0.1",
|
|
42
42
|
"fs-extra": "^11.3.2",
|
|
43
43
|
"glob": "^10.3.10",
|
package/src/deck-demo.js
CHANGED
|
@@ -62,16 +62,9 @@ const propertiesStyle = css`
|
|
|
62
62
|
gap: 1em;
|
|
63
63
|
margin-bottom: 0.75em;
|
|
64
64
|
width: 250px;
|
|
65
|
-
}
|
|
66
|
-
.property-label {
|
|
67
|
-
flex: 1;
|
|
68
|
-
text-align: right;
|
|
69
|
-
font-size: 0.9em;
|
|
70
65
|
color: var(--text-color);
|
|
71
|
-
opacity: 0.8;
|
|
72
66
|
}
|
|
73
67
|
.property-item input {
|
|
74
|
-
flex: 2;
|
|
75
68
|
flex-grow: 0;
|
|
76
69
|
}
|
|
77
70
|
input[type='text'] {
|
|
@@ -144,15 +137,17 @@ function propertyControl(engine, name) {
|
|
|
144
137
|
return input({type: 'range', min: options.min, max: options.max, value}).on({
|
|
145
138
|
input: e => engine.dispatch(new UpdatePropertyValue(name, e.target.valueAsNumber)),
|
|
146
139
|
});
|
|
147
|
-
case '
|
|
148
|
-
return input({type: '
|
|
149
|
-
input: e => engine.dispatch(new UpdatePropertyValue(name, e.target.
|
|
140
|
+
case 'checkbox':
|
|
141
|
+
return input({type: 'checkbox', checked: value}).on({
|
|
142
|
+
input: e => engine.dispatch(new UpdatePropertyValue(name, e.target.checked)),
|
|
150
143
|
});
|
|
151
144
|
default:
|
|
152
|
-
return
|
|
145
|
+
return input({type: options?.type ?? 'text', value}).on({
|
|
146
|
+
input: e => engine.dispatch(new UpdatePropertyValue(name, e.target.value)),
|
|
147
|
+
});
|
|
153
148
|
}
|
|
154
149
|
});
|
|
155
|
-
return
|
|
150
|
+
return label({className: 'property-item'}, name, control);
|
|
156
151
|
});
|
|
157
152
|
}
|
|
158
153
|
|
|
@@ -208,6 +203,8 @@ function createEngine(src, canonicalSrc) {
|
|
|
208
203
|
return;
|
|
209
204
|
}
|
|
210
205
|
|
|
206
|
+
propertyPanelCreated = true;
|
|
207
|
+
|
|
211
208
|
engine.dispatch(
|
|
212
209
|
new CreateOrUpdatePanel({
|
|
213
210
|
name: propsPanelName,
|
|
@@ -817,16 +814,22 @@ class DeckDemo extends HTMLElement {
|
|
|
817
814
|
.key(p.name)
|
|
818
815
|
.opaque()
|
|
819
816
|
.on({
|
|
820
|
-
$
|
|
817
|
+
$update: el => {
|
|
818
|
+
if (p.render === el._renderer) {
|
|
819
|
+
return;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
el._aborter?.abort();
|
|
823
|
+
|
|
821
824
|
const div = document.createElement('div');
|
|
822
825
|
const shadow = div.attachShadow({mode: 'open'});
|
|
823
826
|
const aborter = new AbortController();
|
|
824
827
|
|
|
825
|
-
el.
|
|
828
|
+
el.replaceChildren(div);
|
|
826
829
|
el._aborter = aborter;
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
p.render(
|
|
830
|
+
el._renderer = p.render;
|
|
831
|
+
|
|
832
|
+
p.render(shadow, aborter.signal);
|
|
830
833
|
},
|
|
831
834
|
$detach: el => {
|
|
832
835
|
el._aborter?.abort();
|