@novely/solid-renderer 0.38.0-next.1 → 0.39.0

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/dist/index.jsx CHANGED
@@ -1,7 +1,8 @@
1
- // ../../node_modules/.pnpm/solid-js@1.8.19/node_modules/solid-js/dist/solid.js
1
+ // ../../node_modules/.pnpm/solid-js@1.8.21/node_modules/solid-js/dist/solid.js
2
2
  var sharedConfig = {
3
3
  context: void 0,
4
4
  registry: void 0,
5
+ done: false,
5
6
  getContextId() {
6
7
  return getContextId(this.context.count);
7
8
  },
@@ -274,7 +275,11 @@ function updateComputation(node) {
274
275
  if (!node.fn) return;
275
276
  cleanNode(node);
276
277
  const time = ExecCount;
277
- runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
278
+ runComputation(
279
+ node,
280
+ Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
281
+ time
282
+ );
278
283
  if (Transition && !Transition.running && Transition.sources.has(node)) {
279
284
  queueMicrotask(() => {
280
285
  runUpdates(() => {
@@ -504,7 +509,8 @@ function lookUpstream(node, ignore) {
504
509
  if (source.sources) {
505
510
  const state = runningTransition ? source.tState : source.state;
506
511
  if (state === STALE) {
507
- if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount)) runTop(source);
512
+ if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
513
+ runTop(source);
508
514
  } else if (state === PENDING) lookUpstream(source, ignore);
509
515
  }
510
516
  }
@@ -580,12 +586,13 @@ function handleError(err, owner = Owner) {
580
586
  const fns = ERROR && owner && owner.context && owner.context[ERROR];
581
587
  const error = castError(err);
582
588
  if (!fns) throw error;
583
- if (Effects) Effects.push({
584
- fn() {
585
- runErrors(error, fns, owner);
586
- },
587
- state: STALE
588
- });
589
+ if (Effects)
590
+ Effects.push({
591
+ fn() {
592
+ runErrors(error, fns, owner);
593
+ },
594
+ state: STALE
595
+ });
589
596
  else runErrors(error, fns, owner);
590
597
  }
591
598
  function resolveChildren(children2) {
@@ -603,29 +610,19 @@ function resolveChildren(children2) {
603
610
  function createProvider(id, options) {
604
611
  return function provider(props) {
605
612
  let res;
606
- createRenderEffect(() => res = untrack(() => {
607
- Owner.context = {
608
- ...Owner.context,
609
- [id]: props.value
610
- };
611
- return children(() => props.children);
612
- }), void 0);
613
+ createRenderEffect(
614
+ () => res = untrack(() => {
615
+ Owner.context = {
616
+ ...Owner.context,
617
+ [id]: props.value
618
+ };
619
+ return children(() => props.children);
620
+ }),
621
+ void 0
622
+ );
613
623
  return res;
614
624
  };
615
625
  }
616
- function from(producer) {
617
- const [s, set] = createSignal(void 0, {
618
- equals: false
619
- });
620
- if ("subscribe" in producer) {
621
- const unsub = producer.subscribe((v) => set(() => v));
622
- onCleanup(() => "unsubscribe" in unsub ? unsub.unsubscribe() : unsub());
623
- } else {
624
- const clean2 = producer(set);
625
- onCleanup(clean2);
626
- }
627
- return s;
628
- }
629
626
  var FALLBACK = Symbol("fallback");
630
627
  function dispose(d) {
631
628
  for (let i = 0; i < d.length; i++) d[i]();
@@ -776,25 +773,29 @@ function mergeProps(...sources) {
776
773
  sources[i] = typeof s === "function" ? (proxy = true, createMemo(s)) : s;
777
774
  }
778
775
  if (proxy) {
779
- return new Proxy({
780
- get(property) {
781
- for (let i = sources.length - 1; i >= 0; i--) {
782
- const v = resolveSource(sources[i])[property];
783
- if (v !== void 0) return v;
784
- }
785
- },
786
- has(property) {
787
- for (let i = sources.length - 1; i >= 0; i--) {
788
- if (property in resolveSource(sources[i])) return true;
776
+ return new Proxy(
777
+ {
778
+ get(property) {
779
+ for (let i = sources.length - 1; i >= 0; i--) {
780
+ const v = resolveSource(sources[i])[property];
781
+ if (v !== void 0) return v;
782
+ }
783
+ },
784
+ has(property) {
785
+ for (let i = sources.length - 1; i >= 0; i--) {
786
+ if (property in resolveSource(sources[i])) return true;
787
+ }
788
+ return false;
789
+ },
790
+ keys() {
791
+ const keys2 = [];
792
+ for (let i = 0; i < sources.length; i++)
793
+ keys2.push(...Object.keys(resolveSource(sources[i])));
794
+ return [...new Set(keys2)];
789
795
  }
790
- return false;
791
796
  },
792
- keys() {
793
- const keys2 = [];
794
- for (let i = 0; i < sources.length; i++) keys2.push(...Object.keys(resolveSource(sources[i])));
795
- return [...new Set(keys2)];
796
- }
797
- }, propTraps);
797
+ propTraps
798
+ );
798
799
  }
799
800
  const sourcesMap = {};
800
801
  const defined = /* @__PURE__ */ Object.create(null);
@@ -834,29 +835,37 @@ function splitProps(props, ...keys2) {
834
835
  if ($PROXY in props) {
835
836
  const blocked = new Set(keys2.length > 1 ? keys2.flat() : keys2[0]);
836
837
  const res = keys2.map((k) => {
837
- return new Proxy({
838
- get(property) {
839
- return k.includes(property) ? props[property] : void 0;
840
- },
841
- has(property) {
842
- return k.includes(property) && property in props;
838
+ return new Proxy(
839
+ {
840
+ get(property) {
841
+ return k.includes(property) ? props[property] : void 0;
842
+ },
843
+ has(property) {
844
+ return k.includes(property) && property in props;
845
+ },
846
+ keys() {
847
+ return k.filter((property) => property in props);
848
+ }
843
849
  },
844
- keys() {
845
- return k.filter((property) => property in props);
846
- }
847
- }, propTraps);
850
+ propTraps
851
+ );
848
852
  });
849
- res.push(new Proxy({
850
- get(property) {
851
- return blocked.has(property) ? void 0 : props[property];
852
- },
853
- has(property) {
854
- return blocked.has(property) ? false : property in props;
855
- },
856
- keys() {
857
- return Object.keys(props).filter((k) => !blocked.has(k));
858
- }
859
- }, propTraps));
853
+ res.push(
854
+ new Proxy(
855
+ {
856
+ get(property) {
857
+ return blocked.has(property) ? void 0 : props[property];
858
+ },
859
+ has(property) {
860
+ return blocked.has(property) ? false : property in props;
861
+ },
862
+ keys() {
863
+ return Object.keys(props).filter((k) => !blocked.has(k));
864
+ }
865
+ },
866
+ propTraps
867
+ )
868
+ );
860
869
  return res;
861
870
  }
862
871
  const otherObject = {};
@@ -896,55 +905,115 @@ function Show(props) {
896
905
  const condition = createMemo(() => props.when, void 0, {
897
906
  equals: (a, b) => keyed ? a === b : !a === !b
898
907
  });
899
- return createMemo(() => {
900
- const c = condition();
901
- if (c) {
902
- const child = props.children;
903
- const fn = typeof child === "function" && child.length > 0;
904
- return fn ? untrack(() => child(keyed ? c : () => {
905
- if (!untrack(condition)) throw narrowedError("Show");
906
- return props.when;
907
- })) : child;
908
- }
909
- return props.fallback;
910
- }, void 0, void 0);
908
+ return createMemo(
909
+ () => {
910
+ const c = condition();
911
+ if (c) {
912
+ const child = props.children;
913
+ const fn = typeof child === "function" && child.length > 0;
914
+ return fn ? untrack(
915
+ () => child(
916
+ keyed ? c : () => {
917
+ if (!untrack(condition)) throw narrowedError("Show");
918
+ return props.when;
919
+ }
920
+ )
921
+ ) : child;
922
+ }
923
+ return props.fallback;
924
+ },
925
+ void 0,
926
+ void 0
927
+ );
911
928
  }
912
929
  function Switch(props) {
913
930
  let keyed = false;
914
931
  const equals = (a, b) => (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
915
- const conditions = children(() => props.children), evalConditions = createMemo(() => {
916
- let conds = conditions();
917
- if (!Array.isArray(conds)) conds = [conds];
918
- for (let i = 0; i < conds.length; i++) {
919
- const c = conds[i].when;
920
- if (c) {
921
- keyed = !!conds[i].keyed;
922
- return [i, c, conds[i]];
932
+ const conditions = children(() => props.children), evalConditions = createMemo(
933
+ () => {
934
+ let conds = conditions();
935
+ if (!Array.isArray(conds)) conds = [conds];
936
+ for (let i = 0; i < conds.length; i++) {
937
+ const c = conds[i].when;
938
+ if (c) {
939
+ keyed = !!conds[i].keyed;
940
+ return [i, c, conds[i]];
941
+ }
923
942
  }
943
+ return [-1];
944
+ },
945
+ void 0,
946
+ {
947
+ equals
924
948
  }
925
- return [-1];
926
- }, void 0, {
927
- equals
928
- });
929
- return createMemo(() => {
930
- const [index, when, cond] = evalConditions();
931
- if (index < 0) return props.fallback;
932
- const c = cond.children;
933
- const fn = typeof c === "function" && c.length > 0;
934
- return fn ? untrack(() => c(keyed ? when : () => {
935
- if (untrack(evalConditions)[0] !== index) throw narrowedError("Match");
936
- return cond.when;
937
- })) : c;
938
- }, void 0, void 0);
949
+ );
950
+ return createMemo(
951
+ () => {
952
+ const [index, when, cond] = evalConditions();
953
+ if (index < 0) return props.fallback;
954
+ const c = cond.children;
955
+ const fn = typeof c === "function" && c.length > 0;
956
+ return fn ? untrack(
957
+ () => c(
958
+ keyed ? when : () => {
959
+ if (untrack(evalConditions)[0] !== index) throw narrowedError("Match");
960
+ return cond.when;
961
+ }
962
+ )
963
+ ) : c;
964
+ },
965
+ void 0,
966
+ void 0
967
+ );
939
968
  }
940
969
  function Match(props) {
941
970
  return props;
942
971
  }
943
972
 
944
- // ../../node_modules/.pnpm/solid-js@1.8.19/node_modules/solid-js/web/dist/web.js
945
- var booleans = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "inert", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"];
946
- var Properties = /* @__PURE__ */ new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
947
- var ChildProperties = /* @__PURE__ */ new Set(["innerHTML", "textContent", "innerText", "children"]);
973
+ // ../../node_modules/.pnpm/solid-js@1.8.21/node_modules/solid-js/web/dist/web.js
974
+ var booleans = [
975
+ "allowfullscreen",
976
+ "async",
977
+ "autofocus",
978
+ "autoplay",
979
+ "checked",
980
+ "controls",
981
+ "default",
982
+ "disabled",
983
+ "formnovalidate",
984
+ "hidden",
985
+ "indeterminate",
986
+ "inert",
987
+ "ismap",
988
+ "loop",
989
+ "multiple",
990
+ "muted",
991
+ "nomodule",
992
+ "novalidate",
993
+ "open",
994
+ "playsinline",
995
+ "readonly",
996
+ "required",
997
+ "reversed",
998
+ "seamless",
999
+ "selected"
1000
+ ];
1001
+ var Properties = /* @__PURE__ */ new Set([
1002
+ "className",
1003
+ "value",
1004
+ "readOnly",
1005
+ "formNoValidate",
1006
+ "isMap",
1007
+ "noModule",
1008
+ "playsInline",
1009
+ ...booleans
1010
+ ]);
1011
+ var ChildProperties = /* @__PURE__ */ new Set([
1012
+ "innerHTML",
1013
+ "textContent",
1014
+ "innerText",
1015
+ "children"
1016
+ ]);
948
1017
  var Aliases = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(null), {
949
1018
  className: "class",
950
1019
  htmlFor: "for"
@@ -978,7 +1047,30 @@ function getPropAlias(prop, tagName) {
978
1047
  const a = PropAliases[prop];
979
1048
  return typeof a === "object" ? a[tagName] ? a["$"] : void 0 : a;
980
1049
  }
981
- var DelegatedEvents = /* @__PURE__ */ new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
1050
+ var DelegatedEvents = /* @__PURE__ */ new Set([
1051
+ "beforeinput",
1052
+ "click",
1053
+ "dblclick",
1054
+ "contextmenu",
1055
+ "focusin",
1056
+ "focusout",
1057
+ "input",
1058
+ "keydown",
1059
+ "keyup",
1060
+ "mousedown",
1061
+ "mousemove",
1062
+ "mouseout",
1063
+ "mouseover",
1064
+ "mouseup",
1065
+ "pointerdown",
1066
+ "pointermove",
1067
+ "pointerout",
1068
+ "pointerover",
1069
+ "pointerup",
1070
+ "touchend",
1071
+ "touchmove",
1072
+ "touchstart"
1073
+ ]);
982
1074
  var SVGNamespace = {
983
1075
  xlink: "http://www.w3.org/1999/xlink",
984
1076
  xml: "http://www.w3.org/XML/1998/namespace"
@@ -1065,17 +1157,17 @@ function delegateEvents(eventNames, document2 = window.document) {
1065
1157
  }
1066
1158
  }
1067
1159
  function setAttribute(node, name, value) {
1068
- if (!!sharedConfig.context && node.isConnected) return;
1160
+ if (isHydrating(node)) return;
1069
1161
  if (value == null) node.removeAttribute(name);
1070
1162
  else node.setAttribute(name, value);
1071
1163
  }
1072
1164
  function setAttributeNS(node, namespace, name, value) {
1073
- if (!!sharedConfig.context && node.isConnected) return;
1165
+ if (isHydrating(node)) return;
1074
1166
  if (value == null) node.removeAttributeNS(namespace, name);
1075
1167
  else node.setAttributeNS(namespace, name, value);
1076
1168
  }
1077
1169
  function className(node, value) {
1078
- if (!!sharedConfig.context && node.isConnected) return;
1170
+ if (isHydrating(node)) return;
1079
1171
  if (value == null) node.removeAttribute("class");
1080
1172
  else node.className = value;
1081
1173
  }
@@ -1131,7 +1223,9 @@ function style(node, value, prev) {
1131
1223
  function spread(node, props = {}, isSVG, skipChildren) {
1132
1224
  const prevProps = {};
1133
1225
  if (!skipChildren) {
1134
- createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
1226
+ createRenderEffect(
1227
+ () => prevProps.children = insertExpression(node, props.children, prevProps.children)
1228
+ );
1135
1229
  }
1136
1230
  createRenderEffect(() => typeof props.ref === "function" && use(props.ref, node));
1137
1231
  createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
@@ -1162,12 +1256,16 @@ function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = fals
1162
1256
  prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef);
1163
1257
  }
1164
1258
  }
1259
+ function isHydrating(node) {
1260
+ return !!sharedConfig.context && !sharedConfig.done && (!node || node.isConnected);
1261
+ }
1165
1262
  function toPropertyName(name) {
1166
1263
  return name.toLowerCase().replace(/-([a-z])/g, (_, w) => w.toUpperCase());
1167
1264
  }
1168
1265
  function toggleClassKey(node, key, value) {
1169
1266
  const classNames = key.trim().split(/\s+/);
1170
- for (let i = 0, nameLen = classNames.length; i < nameLen; i++) node.classList.toggle(classNames[i], value);
1267
+ for (let i = 0, nameLen = classNames.length; i < nameLen; i++)
1268
+ node.classList.toggle(classNames[i], value);
1171
1269
  }
1172
1270
  function assignProp(node, prop, value, prev, isSVG, skipRef) {
1173
1271
  let isCE, isProp, isChildProp, propAlias, forceProp;
@@ -1201,7 +1299,7 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
1201
1299
  if (forceProp) {
1202
1300
  prop = prop.slice(5);
1203
1301
  isProp = true;
1204
- } else if (!!sharedConfig.context && node.isConnected) return value;
1302
+ } else if (isHydrating(node)) return value;
1205
1303
  if (prop === "class" || prop === "className") className(node, value);
1206
1304
  else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;
1207
1305
  else node[propAlias || prop] = value;
@@ -1213,6 +1311,9 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
1213
1311
  return value;
1214
1312
  }
1215
1313
  function eventHandler(e) {
1314
+ if (sharedConfig.registry && sharedConfig.events) {
1315
+ if (sharedConfig.events.find(([el, ev]) => ev === e)) return;
1316
+ }
1216
1317
  const key = `$$${e.type}`;
1217
1318
  let node = e.composedPath && e.composedPath()[0] || e.target;
1218
1319
  if (e.target !== node) {
@@ -1239,7 +1340,7 @@ function eventHandler(e) {
1239
1340
  }
1240
1341
  }
1241
1342
  function insertExpression(parent, value, current, marker, unwrapArray) {
1242
- const hydrating = !!sharedConfig.context && parent.isConnected;
1343
+ const hydrating = isHydrating(parent);
1243
1344
  if (hydrating) {
1244
1345
  !current && (current = [...parent.childNodes]);
1245
1346
  let cleaned = [];
@@ -1290,9 +1391,10 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
1290
1391
  }
1291
1392
  if (hydrating) {
1292
1393
  if (!array.length) return current;
1293
- if (marker === void 0) return [...parent.childNodes];
1394
+ if (marker === void 0) return current = [...parent.childNodes];
1294
1395
  let node = array[0];
1295
- let nodes = [node];
1396
+ if (node.parentNode !== parent) return current;
1397
+ const nodes = [node];
1296
1398
  while ((node = node.nextSibling) !== marker) nodes.push(node);
1297
1399
  return current = nodes;
1298
1400
  }
@@ -1332,7 +1434,11 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
1332
1434
  } else if (t === "function") {
1333
1435
  if (unwrap) {
1334
1436
  while (typeof item === "function") item = item();
1335
- dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], Array.isArray(prev) ? prev : [prev]) || dynamic;
1437
+ dynamic = normalizeIncomingArray(
1438
+ normalized,
1439
+ Array.isArray(item) ? item : [item],
1440
+ Array.isArray(prev) ? prev : [prev]
1441
+ ) || dynamic;
1336
1442
  } else {
1337
1443
  normalized.push(item);
1338
1444
  dynamic = true;
@@ -1357,7 +1463,8 @@ function cleanChildren(parent, current, marker, replacement) {
1357
1463
  const el = current[i];
1358
1464
  if (node !== el) {
1359
1465
  const isParent = el.parentNode === parent;
1360
- if (!inserted && !i) isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
1466
+ if (!inserted && !i)
1467
+ isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
1361
1468
  else isParent && el.remove();
1362
1469
  } else inserted = true;
1363
1470
  }
@@ -1371,38 +1478,40 @@ function createElement(tagName, isSVG = false) {
1371
1478
  return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName);
1372
1479
  }
1373
1480
  function Portal(props) {
1374
- const {
1375
- useShadow
1376
- } = props, marker = document.createTextNode(""), mount = () => props.mount || document.body, owner = getOwner();
1481
+ const { useShadow } = props, marker = document.createTextNode(""), mount = () => props.mount || document.body, owner = getOwner();
1377
1482
  let content;
1378
1483
  let hydrating = !!sharedConfig.context;
1379
- createEffect(() => {
1380
- if (hydrating) getOwner().user = hydrating = false;
1381
- content || (content = runWithOwner(owner, () => createMemo(() => props.children)));
1382
- const el = mount();
1383
- if (el instanceof HTMLHeadElement) {
1384
- const [clean2, setClean] = createSignal(false);
1385
- const cleanup = () => setClean(true);
1386
- createRoot((dispose2) => insert(el, () => !clean2() ? content() : dispose2(), null));
1387
- onCleanup(cleanup);
1388
- } else {
1389
- const container = createElement(props.isSVG ? "g" : "div", props.isSVG), renderRoot = useShadow && container.attachShadow ? container.attachShadow({
1390
- mode: "open"
1391
- }) : container;
1392
- Object.defineProperty(container, "_$host", {
1393
- get() {
1394
- return marker.parentNode;
1395
- },
1396
- configurable: true
1397
- });
1398
- insert(renderRoot, content);
1399
- el.appendChild(container);
1400
- props.ref && props.ref(container);
1401
- onCleanup(() => el.removeChild(container));
1484
+ createEffect(
1485
+ () => {
1486
+ if (hydrating) getOwner().user = hydrating = false;
1487
+ content || (content = runWithOwner(owner, () => createMemo(() => props.children)));
1488
+ const el = mount();
1489
+ if (el instanceof HTMLHeadElement) {
1490
+ const [clean2, setClean] = createSignal(false);
1491
+ const cleanup = () => setClean(true);
1492
+ createRoot((dispose2) => insert(el, () => !clean2() ? content() : dispose2(), null));
1493
+ onCleanup(cleanup);
1494
+ } else {
1495
+ const container = createElement(props.isSVG ? "g" : "div", props.isSVG), renderRoot = useShadow && container.attachShadow ? container.attachShadow({
1496
+ mode: "open"
1497
+ }) : container;
1498
+ Object.defineProperty(container, "_$host", {
1499
+ get() {
1500
+ return marker.parentNode;
1501
+ },
1502
+ configurable: true
1503
+ });
1504
+ insert(renderRoot, content);
1505
+ el.appendChild(container);
1506
+ props.ref && props.ref(container);
1507
+ onCleanup(() => el.removeChild(container));
1508
+ }
1509
+ },
1510
+ void 0,
1511
+ {
1512
+ render: !hydrating
1402
1513
  }
1403
- }, void 0, {
1404
- render: !hydrating
1405
- });
1514
+ );
1406
1515
  return marker;
1407
1516
  }
1408
1517
 
@@ -2760,6 +2869,7 @@ var handleInputAction = ($contextState, options, context, label, onInput, setup,
2760
2869
  const input = document.createElement("input");
2761
2870
  input.setAttribute("type", "text");
2762
2871
  input.setAttribute("name", "novely-input");
2872
+ input.setAttribute("id", "novely-input");
2763
2873
  input.setAttribute("required", "true");
2764
2874
  input.setAttribute("autocomplete", "off");
2765
2875
  !context.meta.preview && input.addEventListener("input", onInputHandler);
@@ -2957,6 +3067,13 @@ var createRetrieved = (fn) => {
2957
3067
  return value;
2958
3068
  };
2959
3069
  };
3070
+ var from = (producer) => {
3071
+ const [s, set] = createSignal(producer.get(), {
3072
+ equals: false
3073
+ });
3074
+ onCleanup(producer.subscribe(set));
3075
+ return s;
3076
+ };
2960
3077
 
2961
3078
  // src/hooks/useMedia.ts
2962
3079
  var useMedia = (media) => {
@@ -3293,7 +3410,7 @@ var Modal = (props) => {
3293
3410
  })();
3294
3411
  };
3295
3412
 
3296
- // ../../node_modules/.pnpm/@solid-primitives+transition-group@1.0.5_solid-js@1.8.19/node_modules/@solid-primitives/transition-group/dist/index.js
3413
+ // ../../node_modules/.pnpm/@solid-primitives+transition-group@1.0.5_solid-js@1.8.21/node_modules/@solid-primitives/transition-group/dist/index.js
3297
3414
  var noop2 = () => {
3298
3415
  };
3299
3416
  var noopTransition = (el, done) => done();
@@ -3361,10 +3478,10 @@ function createSwitchTransition(source, options) {
3361
3478
  return returned;
3362
3479
  }
3363
3480
 
3364
- // ../../node_modules/.pnpm/@solid-primitives+utils@6.2.3_solid-js@1.8.19/node_modules/@solid-primitives/utils/dist/chunk/R5675YMU.js
3481
+ // ../../node_modules/.pnpm/@solid-primitives+utils@6.2.3_solid-js@1.8.21/node_modules/@solid-primitives/utils/dist/chunk/R5675YMU.js
3365
3482
  var access = (v) => typeof v === "function" && !v.length ? v() : v;
3366
3483
 
3367
- // ../../node_modules/.pnpm/@solid-primitives+refs@1.0.8_solid-js@1.8.19/node_modules/@solid-primitives/refs/dist/index.js
3484
+ // ../../node_modules/.pnpm/@solid-primitives+refs@1.0.8_solid-js@1.8.21/node_modules/@solid-primitives/refs/dist/index.js
3368
3485
  var defaultElementPredicate = isServer ? (item) => item != null && typeof item === "object" && "t" in item : (item) => item instanceof Element;
3369
3486
  function getFirstChild(value, predicate) {
3370
3487
  if (predicate(value))
@@ -3385,7 +3502,7 @@ function resolveFirst(fn, predicate = defaultElementPredicate, serverPredicate =
3385
3502
  return createMemo(() => getFirstChild(children2(), isServer ? serverPredicate : predicate));
3386
3503
  }
3387
3504
 
3388
- // ../../node_modules/.pnpm/solid-transition-group@0.2.3_solid-js@1.8.19/node_modules/solid-transition-group/dist/index.js
3505
+ // ../../node_modules/.pnpm/solid-transition-group@0.2.3_solid-js@1.8.21/node_modules/solid-transition-group/dist/index.js
3389
3506
  function createClassnames(props) {
3390
3507
  return createMemo(() => {
3391
3508
  const name = props.name || "s";
@@ -3975,7 +4092,7 @@ var clickOutside = (node, handler) => {
3975
4092
  onCleanup(() => document.removeEventListener("click", handleClick, true));
3976
4093
  };
3977
4094
 
3978
- // ../../node_modules/.pnpm/@solid-primitives+destructure@0.1.17_solid-js@1.8.19/node_modules/@solid-primitives/destructure/dist/index.js
4095
+ // ../../node_modules/.pnpm/@solid-primitives+destructure@0.1.17_solid-js@1.8.21/node_modules/@solid-primitives/destructure/dist/index.js
3979
4096
  var isReactiveObject = (value) => typeof value === "object" && value !== null;
3980
4097
  function createProxyCache(obj, get) {
3981
4098
  return new Proxy(
@@ -4023,27 +4140,19 @@ function destructure(source, options) {
4023
4140
  // src/screens/game.tsx
4024
4141
  var _tmpl$27 = /* @__PURE__ */ template(`<div class="action-dialog-person">`);
4025
4142
  var _tmpl$28 = /* @__PURE__ */ template(`<span class="dialog-label">`);
4026
- var _tmpl$34 = /* @__PURE__ */ template(`<label for="novely-input" class="input-dialog-label"><span class="input-dialog-label-text">`);
4027
- var _tmpl$44 = /* @__PURE__ */ template(`<span class="input-dialog-label-text input-dialog-label__error" aria-live="polite" aria-atomic="true">`);
4028
- var _tmpl$53 = /* @__PURE__ */ template(`<button type="submit" class="button dialog-input__button">`);
4029
- var _tmpl$62 = /* @__PURE__ */ template(`<div class="exit-dialog-buttons"><button type="button" class="button"></button><button type="button" class="button">`);
4030
- var _tmpl$72 = /* @__PURE__ */ template(`<button type="button" class="button control-panel__button">`);
4031
- var _tmpl$82 = /* @__PURE__ */ template(`<span class="control-panel-container-fix" aria-hidden="true">&#8203;`);
4032
- var _tmpl$92 = /* @__PURE__ */ template(`<div class="control-panel-container-backdrop">`);
4033
- var _tmpl$102 = /* @__PURE__ */ template(`<div class="control-panel"><div role="menubar" class="control-panel-container">`);
4034
- var _tmpl$112 = /* @__PURE__ */ template(`<div><div class="characters"></div><div class="action-dialog"><div class="action-dialog-container" role="button" tabindex="0"><div class="action-dialog-content"></div></div></div><div></div><div class="action-text" role="button" tabindex="0">`);
4035
- var _tmpl$122 = /* @__PURE__ */ template(`<button type="button" class="button">`);
4143
+ var _tmpl$34 = /* @__PURE__ */ template(`<div class="choice-dialog__choices">`);
4144
+ var _tmpl$44 = /* @__PURE__ */ template(`<label for="novely-input" class="input-dialog__text input-dialog__label">`);
4145
+ var _tmpl$53 = /* @__PURE__ */ template(`<span class="input-dialog__text input-dialog__error" aria-live="polite" aria-atomic="true">`);
4146
+ var _tmpl$62 = /* @__PURE__ */ template(`<button type="submit" class="button dialog-input__button">`);
4147
+ var _tmpl$72 = /* @__PURE__ */ template(`<div class="exit-dialog-buttons"><button type="button" class="button"></button><button type="button" class="button">`);
4148
+ var _tmpl$82 = /* @__PURE__ */ template(`<button type="button" class="button control-panel__button">`);
4149
+ var _tmpl$92 = /* @__PURE__ */ template(`<span class="control-panel-container-fix" aria-hidden="true">&#8203;`);
4150
+ var _tmpl$102 = /* @__PURE__ */ template(`<div class="control-panel-container-backdrop">`);
4151
+ var _tmpl$112 = /* @__PURE__ */ template(`<div class="control-panel"><div role="menubar" class="control-panel-container">`);
4152
+ var _tmpl$122 = /* @__PURE__ */ template(`<div><div class="characters"></div><div class="action-dialog"><div class="action-dialog-container" role="button" tabindex="0"><div class="action-dialog-content"></div></div></div><div></div><div class="action-text" role="button" tabindex="0">`);
4153
+ var _tmpl$132 = /* @__PURE__ */ template(`<button type="button" class="button choice-dialog__choice"><span>`);
4036
4154
  var Game = (props) => {
4037
4155
  const data = useData();
4038
- const {
4039
- $contextState
4040
- } = props;
4041
- const contextState = () => {
4042
- const accessor = from($contextState);
4043
- return () => {
4044
- return accessor();
4045
- };
4046
- };
4047
4156
  const {
4048
4157
  text,
4049
4158
  dialog,
@@ -4052,7 +4161,7 @@ var Game = (props) => {
4052
4161
  input,
4053
4162
  background,
4054
4163
  custom
4055
- } = destructure(contextState());
4164
+ } = destructure(from(props.$contextState));
4056
4165
  const rendererState = from(data.$rendererState);
4057
4166
  const exitPromptShown = () => rendererState().exitPromptShown;
4058
4167
  const {
@@ -4116,7 +4225,7 @@ var Game = (props) => {
4116
4225
  }, 0);
4117
4226
  });
4118
4227
  return (() => {
4119
- const _el$ = _tmpl$112(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling, _el$4 = _el$3.firstChild, _el$6 = _el$4.firstChild, _el$16 = _el$3.nextSibling, _el$17 = _el$16.nextSibling;
4228
+ const _el$ = _tmpl$122(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling, _el$4 = _el$3.firstChild, _el$6 = _el$4.firstChild, _el$16 = _el$3.nextSibling, _el$17 = _el$16.nextSibling;
4120
4229
  insert(_el$, createComponent(Canvas, {
4121
4230
  "class": "background",
4122
4231
  resize: false,
@@ -4241,23 +4350,45 @@ var Game = (props) => {
4241
4350
  _v$2: void 0
4242
4351
  });
4243
4352
  return _el$7;
4244
- })(), createComponent(For, {
4245
- get each() {
4246
- return choice().choices;
4247
- },
4248
- children: ([text2, active], i) => {
4249
- const disabled = !active;
4250
- const index = i();
4251
- return (() => {
4252
- const _el$23 = _tmpl$122();
4253
- _el$23.$$click = onChoicesButtonClick;
4254
- _el$23.$$clickData = [disabled, index];
4255
- setAttribute(_el$23, "aria-disabled", disabled);
4256
- insert(_el$23, text2);
4257
- return _el$23;
4258
- })();
4259
- }
4260
- })];
4353
+ })(), (() => {
4354
+ const _el$8 = _tmpl$34();
4355
+ insert(_el$8, createComponent(For, {
4356
+ get each() {
4357
+ return choice().choices;
4358
+ },
4359
+ children: ([text2, active, visible, image], i) => {
4360
+ const disabled = !active;
4361
+ const index = i();
4362
+ return createComponent(Show, {
4363
+ when: visible,
4364
+ get children() {
4365
+ const _el$23 = _tmpl$132(), _el$24 = _el$23.firstChild;
4366
+ _el$23.$$click = onChoicesButtonClick;
4367
+ _el$23.$$clickData = [disabled, index];
4368
+ setAttribute(_el$23, "aria-disabled", disabled);
4369
+ insert(_el$24, text2);
4370
+ insert(_el$23, createComponent(Show, {
4371
+ when: image !== "",
4372
+ get children() {
4373
+ return createComponent(Canvas, {
4374
+ "class": "choice-dialog__choice-image",
4375
+ resize: false,
4376
+ render: async (canvas, ctx) => {
4377
+ const img = await imagePreloadWithCaching(image);
4378
+ canvas.width = img.width;
4379
+ canvas.height = img.height;
4380
+ ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
4381
+ }
4382
+ });
4383
+ }
4384
+ }), null);
4385
+ return _el$23;
4386
+ }
4387
+ });
4388
+ }
4389
+ }));
4390
+ return _el$8;
4391
+ })()];
4261
4392
  }
4262
4393
  }), _el$16);
4263
4394
  insert(_el$, createComponent(Modal, {
@@ -4270,16 +4401,15 @@ var Game = (props) => {
4270
4401
  trapFocus: () => !props.isPreview && !exitPromptShown(),
4271
4402
  get children() {
4272
4403
  return [(() => {
4273
- const _el$8 = _tmpl$34(), _el$9 = _el$8.firstChild;
4404
+ const _el$9 = _tmpl$44();
4274
4405
  insert(_el$9, () => input().label);
4275
- insert(_el$8, () => input().element, null);
4276
- return _el$8;
4277
- })(), (() => {
4278
- const _el$10 = _tmpl$44();
4406
+ return _el$9;
4407
+ })(), createMemo(() => input().element), (() => {
4408
+ const _el$10 = _tmpl$53();
4279
4409
  insert(_el$10, () => input().error);
4280
4410
  return _el$10;
4281
4411
  })(), (() => {
4282
- const _el$11 = _tmpl$53();
4412
+ const _el$11 = _tmpl$62();
4283
4413
  _el$11.$$click = onInputButtonClick;
4284
4414
  insert(_el$11, () => data.t("Sumbit"));
4285
4415
  createRenderEffect(() => setAttribute(_el$11, "aria-disabled", Boolean(input().error)));
@@ -4298,7 +4428,7 @@ var Game = (props) => {
4298
4428
  insert(_el$12, () => data.t("ExitDialogWarning"));
4299
4429
  return _el$12;
4300
4430
  })(), (() => {
4301
- const _el$13 = _tmpl$62(), _el$14 = _el$13.firstChild, _el$15 = _el$14.nextSibling;
4431
+ const _el$13 = _tmpl$72(), _el$14 = _el$13.firstChild, _el$15 = _el$14.nextSibling;
4302
4432
  _el$14.$$click = () => {
4303
4433
  data.$rendererState.setKey("exitPromptShown", false);
4304
4434
  };
@@ -4345,7 +4475,7 @@ var Game = (props) => {
4345
4475
  return !props.isPreview;
4346
4476
  },
4347
4477
  get children() {
4348
- const _el$18 = _tmpl$102(), _el$22 = _el$18.firstChild;
4478
+ const _el$18 = _tmpl$112(), _el$22 = _el$18.firstChild;
4349
4479
  insert(_el$18, createComponent(Show, {
4350
4480
  get when() {
4351
4481
  return data.media.hyperWide();
@@ -4356,7 +4486,7 @@ var Game = (props) => {
4356
4486
  return !controlPanelMenuExpanded();
4357
4487
  },
4358
4488
  get children() {
4359
- const _el$19 = _tmpl$72();
4489
+ const _el$19 = _tmpl$82();
4360
4490
  _el$19.$$click = () => {
4361
4491
  setControlPanelMenuExpanded((prev) => !prev);
4362
4492
  };
@@ -4385,7 +4515,7 @@ var Game = (props) => {
4385
4515
  return createMemo(() => !!(data.media.hyperWide() && controlPanelMenuExpanded()))() && !exitPromptShown();
4386
4516
  },
4387
4517
  get children() {
4388
- return [_tmpl$82(), _tmpl$92()];
4518
+ return [_tmpl$92(), _tmpl$102()];
4389
4519
  }
4390
4520
  }), _el$22);
4391
4521
  use((element) => {
@@ -614,18 +614,34 @@
614
614
  border: none;
615
615
  }
616
616
 
617
- /* src/styles/choice-dialog/index.css */
618
-
619
- /* src/styles/input-dialog/input-dialog.css */
620
- .input-dialog-label {
617
+ /* src/styles/choice-dialog/choices.css */
618
+ .choice-dialog__choices {
621
619
  flex-direction: column;
622
- justify-content: center;
623
- align-items: center;
624
620
  width: 100%;
625
- font-size: 1.2375rem;
621
+ height: 100%;
622
+ display: flex;
623
+ }
624
+ .choice-dialog__choices:has(.choice-dialog__choice-image) {
625
+ flex-direction: row;
626
+ gap: .5rem;
627
+ }
628
+ .choice-dialog__choice {
629
+ flex-direction: column;
630
+ align-items: center;
626
631
  display: flex;
627
632
  }
628
- .input-dialog-label-text {
633
+ .choice-dialog__choice:has(.choice-dialog__choice-image) {
634
+ flex-grow: 1;
635
+ }
636
+ .choice-dialog__choice-image {
637
+ max-width: 25vw;
638
+ max-height: 25vh;
639
+ }
640
+
641
+ /* src/styles/choice-dialog/index.css */
642
+
643
+ /* src/styles/input-dialog/input-dialog.css */
644
+ .input-dialog__text {
629
645
  min-height: 1rem;
630
646
  -webkit-tap-highlight-color: #0000;
631
647
  -webkit-tap-highlight-color: transparent;
@@ -636,23 +652,13 @@
636
652
  margin: .4rem 0;
637
653
  font-size: 1.2375rem;
638
654
  }
639
- .input-dialog-label > input {
640
- min-width: min(10rem, 100%);
641
- max-width: 100%;
642
- }
643
- .input-dialog-label:has(input[type=checkbox]) {
644
- flex-direction: row;
645
- gap: 1.25rem;
646
- }
647
- .input-dialog-label:has(input[type=checkbox]) .input-dialog-label-text {
655
+ .input-dialog__label {
648
656
  width: auto;
657
+ margin-bottom: .6rem;
649
658
  }
650
- .input-dialog-label > input[type=checkbox] {
651
- min-width: unset;
652
- }
653
- .input-dialog-label__error {
654
- min-height: 2rem;
655
- min-height: 2lh;
659
+ .input-dialog__error {
660
+ min-height: 1rem;
661
+ min-height: 1lh;
656
662
  }
657
663
  .input-dialog {
658
664
  color: var(--novely-input-dialog-color, #fff);
@@ -668,10 +674,10 @@
668
674
  min-width: 35vw;
669
675
  }
670
676
  @media (max-aspect-ratio: .8) {
671
- .input-dialog-label-text {
677
+ .input-dialog__text {
672
678
  width: calc(100vw - .5rem);
673
679
  }
674
- .input-dialog-label__error {
680
+ .input-dialog__error {
675
681
  min-height: 3rem;
676
682
  min-height: 3lh;
677
683
  }
@@ -681,6 +687,8 @@
681
687
  input[name=novely-input] {
682
688
  border: none;
683
689
  border-radius: .25rem;
690
+ min-width: min(10rem, 100%);
691
+ max-width: 100%;
684
692
  padding: .25rem;
685
693
  display: block;
686
694
  position: relative;
@@ -689,6 +697,16 @@ input[name=novely-input][type=text],
689
697
  input[name=novely-input][type=number],
690
698
  input[name=novely-input][type=password] {
691
699
  box-shadow: 0 0 0 var(--input-box-shadow-spread-radius, .15rem) var(--novely-input-border-color, #ffc7df);
700
+ outline-offset: var(--input-box-shadow-spread-radius, .15rem);
701
+ }
702
+ input[name=novely-input][type=checkbox] {
703
+ min-width: unset;
704
+ }
705
+ @supports ((-webkit-appearance: none)) {
706
+ input[name=novely-input][type=number] {
707
+ -webkit-appearance: textfield;
708
+ appearance: textfield;
709
+ }
692
710
  }
693
711
 
694
712
  /* src/styles/input-dialog/button/button.css */
package/dist/utils.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import type { Atom } from '@novely/renderer-toolkit';
2
+ import type { Stored } from '@novely/core';
1
3
  declare const capitalize: (str: string) => string;
2
4
  declare const isCSSImage: (str: string) => boolean;
3
5
  declare const createImage: (src: string) => HTMLImageElement;
@@ -28,4 +30,8 @@ declare const getDocumentStyles: () => string;
28
30
  */
29
31
  declare const once: (fn: () => void) => () => void;
30
32
  declare const createRetrieved: <T>(fn: () => T) => () => T;
31
- export { createRetrieved, isCSSImage, canvasDrawImages, url, createImage, capitalize, onKey, simple, getDocumentStyles, once, imageLoaded, imagePreloadWithCaching, imagePreloadWithCachingNotComplete };
33
+ /**
34
+ * Like solid-js's from, but has initial value
35
+ */
36
+ declare const from: <T>(producer: Atom<T> | Stored<T>) => import("solid-js").Accessor<T>;
37
+ export { createRetrieved, isCSSImage, canvasDrawImages, url, createImage, capitalize, onKey, simple, getDocumentStyles, once, imageLoaded, imagePreloadWithCaching, imagePreloadWithCachingNotComplete, from };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@novely/solid-renderer",
3
- "version": "0.38.0-next.1",
3
+ "version": "0.39.0",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -17,10 +17,10 @@
17
17
  "dependencies": {
18
18
  "@solid-primitives/destructure": "^0.1.17",
19
19
  "clsx": "^2.1.1",
20
- "solid-js": "1.8.19",
20
+ "solid-js": "1.8.21",
21
21
  "solid-transition-group": "^0.2.3",
22
- "@novely/core": "0.40.0-next",
23
- "@novely/renderer-toolkit": "0.9.0",
22
+ "@novely/core": "0.42.0",
23
+ "@novely/renderer-toolkit": "0.10.0",
24
24
  "@novely/typewriter": "0.5.1"
25
25
  },
26
26
  "peerDependencies": {