@novely/solid-renderer 0.29.1-beta.5 → 0.29.1-beta.6
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/components/ShadowRoot.d.ts +3 -0
- package/dist/index.jsx +82 -30
- package/package.json +1 -1
package/dist/index.jsx
CHANGED
|
@@ -3828,6 +3828,48 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
3828
3828
|
}
|
|
3829
3829
|
var RequestContext = Symbol();
|
|
3830
3830
|
var isServer = false;
|
|
3831
|
+
var SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
|
3832
|
+
function createElement(tagName, isSVG = false) {
|
|
3833
|
+
return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName);
|
|
3834
|
+
}
|
|
3835
|
+
function Portal(props) {
|
|
3836
|
+
const { useShadow } = props, marker = document.createTextNode(""), mount = () => props.mount || document.body, owner = getOwner();
|
|
3837
|
+
let content;
|
|
3838
|
+
let hydrating = !!sharedConfig.context;
|
|
3839
|
+
createEffect(
|
|
3840
|
+
() => {
|
|
3841
|
+
if (hydrating)
|
|
3842
|
+
getOwner().user = hydrating = false;
|
|
3843
|
+
content || (content = runWithOwner(owner, () => createMemo(() => props.children)));
|
|
3844
|
+
const el = mount();
|
|
3845
|
+
if (el instanceof HTMLHeadElement) {
|
|
3846
|
+
const [clean2, setClean] = createSignal(false);
|
|
3847
|
+
const cleanup = () => setClean(true);
|
|
3848
|
+
createRoot((dispose2) => insert(el, () => !clean2() ? content() : dispose2(), null));
|
|
3849
|
+
onCleanup(cleanup);
|
|
3850
|
+
} else {
|
|
3851
|
+
const container = createElement(props.isSVG ? "g" : "div", props.isSVG), renderRoot = useShadow && container.attachShadow ? container.attachShadow({
|
|
3852
|
+
mode: "open"
|
|
3853
|
+
}) : container;
|
|
3854
|
+
Object.defineProperty(container, "_$host", {
|
|
3855
|
+
get() {
|
|
3856
|
+
return marker.parentNode;
|
|
3857
|
+
},
|
|
3858
|
+
configurable: true
|
|
3859
|
+
});
|
|
3860
|
+
insert(renderRoot, content);
|
|
3861
|
+
el.appendChild(container);
|
|
3862
|
+
props.ref && props.ref(container);
|
|
3863
|
+
onCleanup(() => el.removeChild(container));
|
|
3864
|
+
}
|
|
3865
|
+
},
|
|
3866
|
+
void 0,
|
|
3867
|
+
{
|
|
3868
|
+
render: !hydrating
|
|
3869
|
+
}
|
|
3870
|
+
);
|
|
3871
|
+
return marker;
|
|
3872
|
+
}
|
|
3831
3873
|
|
|
3832
3874
|
// ../../node_modules/.pnpm/nanostores@0.10.3/node_modules/nanostores/task/index.js
|
|
3833
3875
|
var tasks = 0;
|
|
@@ -4754,12 +4796,12 @@ var handleCustomAction = ($contextState, options, context, fn, resolve) => {
|
|
|
4754
4796
|
clear();
|
|
4755
4797
|
$contextState.mutate((s) => s.custom[fn.key], void 0);
|
|
4756
4798
|
};
|
|
4757
|
-
const
|
|
4799
|
+
const createElement2 = () => {
|
|
4758
4800
|
const div = document.createElement("div");
|
|
4759
4801
|
div.setAttribute("data-id", fn.key);
|
|
4760
4802
|
return div;
|
|
4761
4803
|
};
|
|
4762
|
-
const element = insert2 ?
|
|
4804
|
+
const element = insert2 ? createElement2() : null;
|
|
4763
4805
|
const getReturn = {
|
|
4764
4806
|
root: context.root,
|
|
4765
4807
|
element,
|
|
@@ -5496,7 +5538,7 @@ var createRetrieved = (fn) => {
|
|
|
5496
5538
|
|
|
5497
5539
|
// src/components/Save.tsx
|
|
5498
5540
|
var _tmpl$17 = /* @__PURE__ */ template(`<div class="saves__list-item__overlay">`);
|
|
5499
|
-
var _tmpl$24 = /* @__PURE__ */ template(`<iframe
|
|
5541
|
+
var _tmpl$24 = /* @__PURE__ */ template(`<iframe tabindex="-1" class="saves__list-item__iframe" src="about:blank">`);
|
|
5500
5542
|
var _tmpl$33 = /* @__PURE__ */ template(`<li class="saves__list-item"><div class="saves__list-item__load" role="button" tabindex="0"></div><div class="saves__list-item__description"><div></div><div></div></div><button type="reset" class="button saves__button-reset"><span>`);
|
|
5501
5543
|
var _tmpl$43 = /* @__PURE__ */ template(`<div class="saves__list-item__iframe">`);
|
|
5502
5544
|
var CURRENT_DATE = /* @__PURE__ */ new Date();
|
|
@@ -5525,18 +5567,6 @@ var Save = (props) => {
|
|
|
5525
5567
|
const KEY = `save-${timestamp}-${type}`;
|
|
5526
5568
|
const $contextState = useContextState(KEY);
|
|
5527
5569
|
const context = getContext2(KEY);
|
|
5528
|
-
const game = createMemo(() => {
|
|
5529
|
-
return createComponent(Game, {
|
|
5530
|
-
controls: "outside",
|
|
5531
|
-
skipTypewriterWhenGoingBack: true,
|
|
5532
|
-
$contextState,
|
|
5533
|
-
context,
|
|
5534
|
-
get store() {
|
|
5535
|
-
return useShared(KEY);
|
|
5536
|
-
},
|
|
5537
|
-
isPreview: true
|
|
5538
|
-
});
|
|
5539
|
-
});
|
|
5540
5570
|
const year = date.getFullYear();
|
|
5541
5571
|
const stringDate = () => capitalize(date.toLocaleDateString(props.language, {
|
|
5542
5572
|
year: year === CURRENT_YEAR ? void 0 : "numeric",
|
|
@@ -5564,7 +5594,6 @@ var Save = (props) => {
|
|
|
5564
5594
|
return;
|
|
5565
5595
|
contentDocument.head.insertAdjacentHTML("beforeend", `<style>:root { font-size: 30%; background: black; cursor: pointer; } * { pointer-events: none; } *, *::before, *::after { animation-play-state: paused !important; }</style><style>${stylesheet()}</style>`);
|
|
5566
5596
|
context.root = contentDocument.body;
|
|
5567
|
-
context.root.appendChild(game());
|
|
5568
5597
|
setIframeLoaded(true);
|
|
5569
5598
|
};
|
|
5570
5599
|
createEffect(() => {
|
|
@@ -5595,18 +5624,7 @@ var Save = (props) => {
|
|
|
5595
5624
|
});
|
|
5596
5625
|
}
|
|
5597
5626
|
});
|
|
5598
|
-
createEffect(() => {
|
|
5599
|
-
const iframeElement = iframe();
|
|
5600
|
-
if (!iframeElement)
|
|
5601
|
-
return;
|
|
5602
|
-
iframeElement.setAttribute("src", "about:blank");
|
|
5603
|
-
iframeElement.addEventListener("load", onIframeLoaded);
|
|
5604
|
-
});
|
|
5605
5627
|
onCleanup(() => {
|
|
5606
|
-
const iframeElement = iframe();
|
|
5607
|
-
if (iframeElement) {
|
|
5608
|
-
iframeElement.removeEventListener("load", onIframeLoaded);
|
|
5609
|
-
}
|
|
5610
5628
|
const state = useContextState(KEY);
|
|
5611
5629
|
for (const custom of Object.values(state.get().custom)) {
|
|
5612
5630
|
if (!custom)
|
|
@@ -5659,9 +5677,43 @@ var Save = (props) => {
|
|
|
5659
5677
|
return _tmpl$43();
|
|
5660
5678
|
},
|
|
5661
5679
|
get children() {
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5680
|
+
return [(() => {
|
|
5681
|
+
const _el$4 = _tmpl$24();
|
|
5682
|
+
_el$4.addEventListener("load", () => {
|
|
5683
|
+
onIframeLoaded();
|
|
5684
|
+
});
|
|
5685
|
+
use(setIframe, _el$4);
|
|
5686
|
+
setAttribute(
|
|
5687
|
+
_el$4,
|
|
5688
|
+
"loading",
|
|
5689
|
+
void 0
|
|
5690
|
+
/** "lazy" is broken on Firefox Mobile as of now (06.05.2024) */
|
|
5691
|
+
);
|
|
5692
|
+
return _el$4;
|
|
5693
|
+
})(), createComponent(Show, {
|
|
5694
|
+
get when() {
|
|
5695
|
+
return iframeLoaded();
|
|
5696
|
+
},
|
|
5697
|
+
get children() {
|
|
5698
|
+
return createComponent(Portal, {
|
|
5699
|
+
get mount() {
|
|
5700
|
+
return context.root;
|
|
5701
|
+
},
|
|
5702
|
+
get children() {
|
|
5703
|
+
return createComponent(Game, {
|
|
5704
|
+
controls: "outside",
|
|
5705
|
+
skipTypewriterWhenGoingBack: true,
|
|
5706
|
+
$contextState,
|
|
5707
|
+
context,
|
|
5708
|
+
get store() {
|
|
5709
|
+
return useShared(KEY);
|
|
5710
|
+
},
|
|
5711
|
+
isPreview: true
|
|
5712
|
+
});
|
|
5713
|
+
}
|
|
5714
|
+
});
|
|
5715
|
+
}
|
|
5716
|
+
})];
|
|
5665
5717
|
}
|
|
5666
5718
|
}), null);
|
|
5667
5719
|
setAttribute(_el$6, "aria-hidden", true);
|