rename um

This commit is contained in:
Geoff Doty 2024-05-05 21:22:15 -04:00
parent b728135c77
commit 39a48fa66c
5 changed files with 12 additions and 10 deletions

View File

@ -1,8 +1,10 @@
# Tagged
# Um
> Minimal JavaScript UI Builder
An experimental composable UI builder that takes ideas from early [hyperapp](https://github.com/jorgebucaran/hyperapp) design, but does not stick to strict Elm Architecture.
Um, is an experimental composable UI builder that takes ideas from early [hyperapp](https://github.com/jorgebucaran/hyperapp) design, but does not stick to strict Elm Architecture.
Um, because you should think about NOT using it.
## Features
- No Virtual Dom
@ -43,7 +45,7 @@ The `h()` is an **optional** hypertext build utility that weighs in around **~25
```html
<script type="module">
import {app, h} from "./tagged.min.js";
import {app, h} from "./um.min.js";
const myapp = app({
state: {name: "[Your Name Here]", job: "Developer"},
@ -52,7 +54,7 @@ The `h()` is an **optional** hypertext build utility that weighs in around **~25
h("strong", `Greeting from ${state.name}`),
h("div", `Your local ${state.job}`),
h("div", {id: "test"}, [
h("h1", "Hello Tagged"),
h("h1", "Um, Hello"),
h("p", 21),
h("hr")
])

View File

@ -1 +0,0 @@
{"version":3,"names":["tag","args","el","document","createElement","forEach","arg","includes","appendChild","createTextNode","Array","isArray","append","Object","assign","app","opts","data","check","state","view","actions","mount","value","type","update","querySelector","replaceChildren","input","entries","name","action","dispatch","h"],"sources":["dist/tagged.js"],"mappings":"AAQA,SAASA,IAAIA,OAAQC,MACjB,MAAMC,GAAKC,SAASC,cAAcJ,KAelC,OAVAC,KAAKI,SAASC,MAFc,CAAC,UAAW,SAAU,UAAUC,gBAG3CD,KACTJ,GAAGM,YAAYL,SAASM,eAAeH,MAChCI,MAAMC,QAAQL,KACrBJ,GAAGU,UAAUN,KAEbO,OAAOC,OAAOZ,GAAII,IACtB,IAGGJ,EACX,CAEA,SAASa,IAAIC,MAET,IAAIC,KAAUC,MAAMF,KAAKG,MAAO,CAAC,GAC7BC,KAAUF,MAAMF,KAAKI,MAAM,IAAM,OACjCC,QAAUH,MAAMF,KAAKK,QAAS,CAAC,GAC/BC,MAAUN,KAAKM,OAAS,OAG5B,SAASJ,MAAMK,MAAOC,MAClB,cAAcD,cAAiBC,KAAOD,MAAQC,IAClD,CAgCA,MAAMC,OAAS,KACXtB,SAASuB,cAAcJ,OAAOK,gBAAgBP,KAAKH,KAAMI,SAAS,EAQtE,OAJIL,KAAKI,MAAQE,OArBjB,SAAkBM,MAAOP,SACrBR,OAAOgB,QAAQR,SAAShB,SAAQ,EAAEyB,KAAMC,WACd,mBAAXA,SACPV,QAAQS,MAAQ,IAAI7B,QAEhBY,OAAOC,OAAOG,KAAMc,OAAOH,SAAU3B,OAGrCwB,QAAQ,EAEhB,IAGJA,QACJ,CAQIO,CAASf,KAAMI,SAGZ,CAACF,MAtCOA,QACS,iBAAVA,QACNF,KAAO,IAAIA,QAASE,QAIxBM,SAGOR,MA8Bf,CAEA,MAAMgB,EAAIjC,WAEDe,IAAKkB","ignoreList":[]}

View File

@ -1,3 +1,3 @@
/*! Tagged v:0.2 | MIT LICENSE | https://github.com/n2geoff/tagged */
/*! Um v:0.3 | MIT LICENSE | https://github.com/n2geoff/um */
function tag(tag,...args){const el=document.createElement(tag);return args.forEach((arg=>{["boolean","string","number"].includes(typeof arg)?el.appendChild(document.createTextNode(arg)):Array.isArray(arg)?el.append(...arg):Object.assign(el,arg)})),el}function app(opts){let data=check(opts.state,{}),view=check(opts.view,(()=>null)),actions=check(opts.actions,{}),mount=opts.mount||"body";function check(value,type){return typeof value==typeof type?value:type}const update=()=>{document.querySelector(mount).replaceChildren(view(data,actions))};return opts.view&&mount&&function(input,actions){Object.entries(actions).forEach((([name,action])=>{"function"==typeof action&&(actions[name]=(...args)=>{Object.assign(data,action(input,...args)),update()})})),update()}(data,actions),{state:state=>("object"==typeof state&&(data={...data,...state}),update(),data)}}const h=tag;export{app,h};
//# sourceMappingURL=true

1
dist/um.min.js.map vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"names":["tag","args","el","document","createElement","forEach","arg","includes","appendChild","createTextNode","Array","isArray","append","Object","assign","app","opts","data","check","state","view","actions","mount","value","type","update","querySelector","replaceChildren","input","entries","name","action","dispatch","h"],"sources":["dist/um.js"],"mappings":"AAQA,SAASA,IAAIA,OAAQC,MACjB,MAAMC,GAAKC,SAASC,cAAcJ,KAelC,OAVAC,KAAKI,SAASC,MAFc,CAAC,UAAW,SAAU,UAAUC,gBAG3CD,KACTJ,GAAGM,YAAYL,SAASM,eAAeH,MAChCI,MAAMC,QAAQL,KACrBJ,GAAGU,UAAUN,KAEbO,OAAOC,OAAOZ,GAAII,IACtB,IAGGJ,EACX,CAEA,SAASa,IAAIC,MAET,IAAIC,KAAUC,MAAMF,KAAKG,MAAO,CAAC,GAC7BC,KAAUF,MAAMF,KAAKI,MAAM,IAAM,OACjCC,QAAUH,MAAMF,KAAKK,QAAS,CAAC,GAC/BC,MAAUN,KAAKM,OAAS,OAG5B,SAASJ,MAAMK,MAAOC,MAClB,cAAcD,cAAiBC,KAAOD,MAAQC,IAClD,CAgCA,MAAMC,OAAS,KACXtB,SAASuB,cAAcJ,OAAOK,gBAAgBP,KAAKH,KAAMI,SAAS,EAQtE,OAJIL,KAAKI,MAAQE,OArBjB,SAAkBM,MAAOP,SACrBR,OAAOgB,QAAQR,SAAShB,SAAQ,EAAEyB,KAAMC,WACd,mBAAXA,SACPV,QAAQS,MAAQ,IAAI7B,QAEhBY,OAAOC,OAAOG,KAAMc,OAAOH,SAAU3B,OAGrCwB,QAAQ,EAEhB,IAGJA,QACJ,CAQIO,CAASf,KAAMI,SAGZ,CAACF,MAtCOA,QACS,iBAAVA,QACNF,KAAO,IAAIA,QAASE,QAIxBM,SAGOR,MA8Bf,CAEA,MAAMgB,EAAIjC,WAEDe,IAAKkB","ignoreList":[]}

View File

@ -1,7 +1,7 @@
build:
bunx rollup src/index.js --file dist/tagged.js --format esm
bunx rollup src/index.js --file dist/um.js --format esm
minify:
bunx terser dist/tagged.js -c -o dist/tagged.min.js --source-map url
bunx terser dist/um.js -c -o dist/um.min.js --source-map url
all: build minify