change to add preact

This commit is contained in:
Seth Trowbridge 2024-05-14 17:17:10 -04:00
parent 9bc6ae00bc
commit b2b868d62f
12 changed files with 30 additions and 9 deletions

View File

@ -1,5 +1,12 @@
import * as ISO from ">able/iso-elements.tsx";
import React from "react";
const Custom =()=>{
const [countGet, countSet] = React.useState(5)
return <h1 class="p-4 bg-emerald-400 font-black" onClick={_=>countSet(countGet+1)}>CUSTOM {countGet}</h1>;
}
export default ()=><div>
<h1 class="p-4 bg-red-500 text-white">App</h1>
<h1 class="p-4 bg-blue-500 text-white">App</h1>
<Custom/>
</div>;

4
bundled/preact/compat.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,7 @@
/* esm.sh - esbuild bundle(preact@10.20.2/jsx-runtime) es2022 production */
import{options as c,Fragment as _}from"./compat.js";
import{Fragment as C}from"./compat.js";
var v=/["&<]/;function p(t){if(t.length===0||v.test(t)===!1)return t;for(var r=0,e=0,a="",o="";e<t.length;e++){switch(t.charCodeAt(e)){case 34:o="&quot;";break;case 38:o="&amp;";break;case 60:o="&lt;";break;default:continue}e!==r&&(a+=t.slice(r,e)),a+=o,r=e+1}return e!==r&&(a+=t.slice(r,e)),a}var y=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,d=0,x=Array.isArray;function g(t,r,e,a,o,i){var s,n,f={};for(n in r)n=="ref"?s=r[n]:f[n]=r[n];var u={type:t,props:f,key:e,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--d,__i:-1,__u:0,__source:o,__self:i};if(typeof t=="function"&&(s=t.defaultProps))for(n in s)f[n]===void 0&&(f[n]=s[n]);return c.vnode&&c.vnode(u),u}function h(t){var r=g(_,{tpl:t,exprs:[].slice.call(arguments,1)});return r.key=r.__v,r}var l={},m=/[A-Z]/g;function k(t,r){if(c.attr){var e=c.attr(t,r);if(typeof e=="string")return e}if(t==="ref"||t==="key")return"";if(t==="style"&&typeof r=="object"){var a="";for(var o in r){var i=r[o];if(i!=null&&i!==""){var s=o[0]=="-"?o:l[o]||(l[o]=o.replace(m,"-$&").toLowerCase()),n=";";typeof i!="number"||s.startsWith("--")||y.test(s)||(n="px;"),a=a+s+":"+i+n}}return t+'="'+a+'"'}return r==null||r===!1||typeof r=="function"||typeof r=="object"?"":r===!0?t:t+'="'+p(r)+'"'}function b(t){if(t==null||typeof t=="boolean"||typeof t=="function")return null;if(typeof t=="object"){if(t.constructor===void 0)return t;if(x(t)){for(var r=0;r<t.length;r++)t[r]=b(t[r]);return t}}return p(""+t)}
export{C as Fragment,g as jsx,k as jsxAttr,g as jsxDEV,b as jsxEscape,h as jsxTemplate,g as jsxs};

View File

@ -1,5 +1,8 @@
import * as TW from "./core.js";
import {presetAutoprefix, presetTailwind} from "./presets.js"
import * as TW from "./twind/core.js";
import {presetAutoprefix, presetTailwind} from "./twind/presets.js"
import * as BUNDLE from "./preact/compat.js";
const Configure =
{

View File

@ -7,9 +7,8 @@
"react/": "https://esm.sh/preact@10.20.2/compat/",
"@preact/signals": "https://esm.sh/@preact/signals@1.2.3?deps=preact@10.20.2",
"signals-original": "https://esm.sh/@preact/signals@1.2.3?deps=preact@10.20.2",
"@twind/": "./bundled/",
"@twind/": "http://localhost:4507/bundled/twind/",
">other/": "https://esm.sh/",
">able/": "./",
">able/app.tsx": "./app.tsx"
},

View File

@ -31,7 +31,7 @@ export const HMR =
RegisteredComponents: new Map() as Map<string, ()=>void>,
statesNew: new Map() as Map<string, StateCapture>,
statesOld: new Map() as Map<string, StateCapture>,
wireframe: false,
wireframe: true,
RegisterComponent(reactID:string, value:()=>void):void
{
this.RegisteredComponents.set(reactID, value);
@ -172,5 +172,5 @@ const ProxyReducer =(inReducer:(inState:Storelike, inAction:string)=>Storelike,
};
export * from "react-original";
export {ProxyCreate as createElement, ProxyState as useState, ProxyReducer as useReducer };
export default {...ReactParts, createElement:ProxyCreate, useState:ProxyState, useReducer:ProxyReducer};
export {ProxyCreate as createElement, ProxyCreate as jsxs, ProxyCreate as jsx, ProxyState as useState, ProxyReducer as useReducer };
export default {...ReactParts, createElement:ProxyCreate, useState:ProxyState, useReducer:ProxyReducer };

View File

@ -28,6 +28,7 @@ Configure({
{
inImports["react-original"] = inImports["react"];
inImports["react"] = `/>able/hmr-react.tsx`;
inImports["react/jsx-runtime"] = `/>able/hmr-react.tsx`;
inImports["signals-original"] = inImports["@preact/signals"];
inImports["@preact/signals"] = `/>able/hmr-signal.tsx`;

View File

@ -1,6 +1,6 @@
import * as MIME from "https://deno.land/std@0.180.0/media_types/mod.ts";
import * as SWCW from "https://esm.sh/@swc/wasm-web@1.3.62";
import SSR from "https://esm.sh/preact-render-to-string@6.4.2";
import SSR from "https://esm.sh/preact-render-to-string@6.4.2?external=react&alias=preact:react";
import { HuntConfig, Root } from "./checker.tsx";
import CustomServe from ">able/api.tsx";