live-atom 1.0.1 → 1.2.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/cdn.js +28 -0
- package/main.js +2 -2
- package/package.json +16 -2
package/cdn.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var liveAtom=(()=>{var l=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var v=(t,o)=>{for(var e in o)l(t,e,{get:o[e],enumerable:!0})},z=(t,o,e,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of $(o))!y.call(t,i)&&i!==e&&l(t,i,{get:()=>o[i],enumerable:!(a=w(o,i))||a.enumerable});return t};var j=t=>z(l({},"__esModule",{value:!0}),t);var L={};v(L,{addClass:()=>p,default:()=>M,init:()=>x});var k={"atom-mx-auto":{"margin-left":"auto","margin-right":"auto"},"atom-w-full":{width:"100%"},"atom-h-full":{height:"100%"},"atom-w-screen":{width:"100vw"},"atom-h-screen":{height:"100vh"},"atom-h-dvh":{height:"100dvh"},"atom-w-dvw":{width:"100dvw"},"atom-h-svh":{height:"100svh"},"atom-w-svw":{width:"100svw"},"atom-h-lvh":{height:"100lvh"},"atom-w-lvw":{width:"100lvw"},"atom-border":{"border-width":"1px"},"atom-border-solid":{"border-style":"solid"},"atom-border-dashed":{"border-style":"dashed"},"atom-border-dotted":{"border-style":"dotted"},"atom-border-double":{"border-style":"double"},"atom-border-none":{"border-style":"none"},"atom-rounded-none":{"border-radius":"0px"},"atom-rounded-sm":{"border-radius":"4px"},"atom-rounded-md":{"border-radius":"6px"},"atom-rounded-lg":{"border-radius":"8px"},"atom-rounded-xl":{"border-radius":"12px"},"atom-rounded-2xl":{"border-radius":"16px"},"atom-rounded-3xl":{"border-radius":"24px"},"atom-rounded-4xl":{"border-radius":"32px"},"atom-rounded-full":{"border-radius":"9999px"},"atom-text-xs":{"font-size":"12px"},"atom-text-sm":{"font-size":"14px"},"atom-text-base":{"font-size":"16px"},"atom-text-lg":{"font-size":"18px"},"atom-text-xl":{"font-size":"20px"},"atom-text-2xl":{"font-size":"24px"},"atom-text-3xl":{"font-size":"30px"},"atom-text-4xl":{"font-size":"36px"},"atom-text-5xl":{"font-size":"48px"},"atom-text-6xl":{"font-size":"60px"},"atom-text-7xl":{"font-size":"72px"},"atom-text-8xl":{"font-size":"96px"},"atom-text-9xl":{"font-size":"128px"},"atom-text-left":{"text-align":"left"},"atom-text-center":{"text-align":"center"},"atom-text-right":{"text-align":"right"},"atom-text-justify":{"text-align":"justify"},"atom-text-start":{"text-align":"start"},"atom-text-end":{"text-align":"end"},"atom-font-thin":{"font-weight":"100"},"atom-font-extralight":{"font-weight":"200"},"atom-font-light":{"font-weight":"300"},"atom-font-normal":{"font-weight":"400"},"atom-font-medium":{"font-weight":"500"},"atom-font-semibold":{"font-weight":"600"},"atom-font-bold":{"font-weight":"700"},"atom-font-extrabold":{"font-weight":"800"},"atom-font-black":{"font-weight":"900"},"atom-uppercase":{"text-transform":"uppercase"},"atom-lowercase":{"text-transform":"lowercase"},"atom-capitalize":{"text-transform":"capitalize"},"atom-normal-case":{"text-transform":"none"},"atom-underline":{"text-decoration":"underline"},"atom-overline":{"text-decoration":"overline"},"atom-line-through":{"text-decoration":"line-through"},"atom-no-underline":{"text-decoration":"none"},"atom-block":{display:"block"},"atom-inline":{display:"inline"},"atom-inline-block":{display:"inline-block"},"atom-hidden":{display:"none"},"atom-flex":{display:"flex"},"atom-inline-flex":{display:"inline-flex"},"atom-grid":{display:"grid"},"atom-inline-grid":{display:"inline-grid"},"atom-flex-row":{"flex-direction":"row"},"atom-flex-row-reverse":{"flex-direction":"row-reverse"},"atom-flex-col":{"flex-direction":"column"},"atom-flex-col-reverse":{"flex-direction":"column-reverse"},"atom-flex-wrap":{"flex-wrap":"wrap"},"atom-flex-nowrap":{"flex-wrap":"nowrap"},"atom-flex-wrap-reverse":{"flex-wrap":"wrap-reverse"},"atom-items-start":{"align-items":"flex-start"},"atom-items-center":{"align-items":"center"},"atom-items-end":{"align-items":"flex-end"},"atom-items-stretch":{"align-items":"stretch"},"atom-items-baseline":{"align-items":"baseline"},"atom-justify-start":{"justify-content":"flex-start"},"atom-justify-center":{"justify-content":"center"},"atom-justify-end":{"justify-content":"flex-end"},"atom-justify-between":{"justify-content":"space-between"},"atom-justify-around":{"justify-content":"space-around"},"atom-justify-evenly":{"justify-content":"space-evenly"},"atom-cursor-pointer":{cursor:"pointer"},"atom-cursor-default":{cursor:"default"},"atom-cursor-not-allowed":{cursor:"not-allowed"},"atom-cursor-text":{cursor:"text"},"atom-cursor-move":{cursor:"move"},"atom-static":{position:"static"},"atom-relative":{position:"relative"},"atom-absolute":{position:"absolute"},"atom-fixed":{position:"fixed"},"atom-sticky":{position:"sticky"},"atom-top-0":{top:"0"},"atom-left-0":{left:"0"},"atom-right-0":{right:"0"},"atom-bottom-0":{bottom:"0"},"atom-transition-all":{"transition-property":"all","transition-timing-function":"cubic-bezier(0.4, 0, 0.2, 1)"},"atom-transition-colors":{"transition-property":"color, background-color, border-color, text-decoration-color, fill, stroke","transition-timing-function":"cubic-bezier(0.4, 0, 0.2, 1)"},"atom-transition-opacity":{"transition-property":"opacity","transition-timing-function":"cubic-bezier(0.4, 0, 0.2, 1)"},"atom-overflow-hidden":{overflow:"hidden"},"atom-overflow-auto":{overflow:"auto"},"atom-overflow-scroll":{overflow:"scroll"},"atom-object-cover":{"object-fit":"cover"},"atom-object-contain":{"object-fit":"contain"},"atom-whitespace-nowrap":{"white-space":"nowrap"},"atom-truncate":{overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"},"atom-box-border":{"box-sizing":"border-box"},"atom-box-content":{"box-sizing":"content-box"},"atom-opacity-0":{opacity:"0"},"atom-opacity-25":{opacity:"0.25"},"atom-opacity-50":{opacity:"0.5"},"atom-opacity-75":{opacity:"0.75"},"atom-opacity-100":{opacity:"1"}},d=k;var f=new Set,r=null;function S(){return r||(r=document.createElement("style"),r.id="live-atom-runtime",document.head.appendChild(r)),r}function b(t){let o=S();if(o.sheet)try{o.sheet.insertRule(t,o.sheet.cssRules.length)}catch{console.warn(`LiveAtom: Failed to parse rule - ${t}`)}else o.appendChild(document.createTextNode(t))}var n={red:{50:"#fef2f2",100:"#ffe2e2",200:"#ffc9c9",300:"#ffa2a2",400:"#ff6467",500:"#fb2c36",600:"#e7000b",700:"#c10007",800:"#9f0712",900:"#82181a",950:"#460809"},orange:{50:"#fff7ed",100:"#ffedd4",200:"#ffd6a8",300:"#ffb86a",400:"#ff8904",500:"#ff6900",600:"#f54900",700:"#ca3500",800:"#9f2d00",900:"#7e2a0c",950:"#441306"},yellow:{50:"#fefce8",100:"#fef9c2",200:"#fff085",300:"#ffdf20",400:"#fdc700",500:"#f0b100",600:"#d08700",700:"#a65f00",800:"#894b00",900:"#733e0a",950:"#432004"},green:{50:"#f0fdf4",100:"#dcfce7",200:"#b9f8cf",300:"#7bf1a8",400:"#05df72",500:"#00c950",600:"#00a63e",700:"#008236",800:"#016630",900:"#0d542b",950:"#032e15"},blue:{50:"#eff6ff",100:"#dbeafe",200:"#bedbff",300:"#8ec5ff",400:"#51a2ff",500:"#2b7fff",600:"#155dfc",700:"#1447e6",800:"#193cb8",900:"#1c398e",950:"#162456"},purple:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d4ff",300:"#dab2ff",400:"#c27aff",500:"#ad46ff",600:"#9810fa",700:"#8200db",800:"#6e11b0",900:"#59168b",950:"#3c0366"},pink:{50:"#fdf2f8",100:"#fce7f3",200:"#fccee8",300:"#fda5d5",400:"#fb64b6",500:"#f6339a",600:"#e60076",700:"#c6005c",800:"#a3004c",900:"#861043",950:"#510424"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5dc",400:"#99a1af",500:"#6a7282",600:"#4a5565",700:"#364153",800:"#1e2939",900:"#101828",950:"#030712"}},C=[{match:/^atom-p-(\d+)$/,action:([,t])=>({padding:`${t*4}px`})},{match:/^atom-px-(\d+)$/,action:([,t])=>({"padding-left":`${t*4}px`,"padding-right":`${t*4}px`})},{match:/^atom-py-(\d+)$/,action:([,t])=>({"padding-top":`${t*4}px`,"padding-bottom":`${t*4}px`})},{match:/^atom-pt-(\d+)$/,action:([,t])=>({"padding-top":`${t*4}px`})},{match:/^atom-pr-(\d+)$/,action:([,t])=>({"padding-right":`${t*4}px`})},{match:/^atom-pb-(\d+)$/,action:([,t])=>({"padding-bottom":`${t*4}px`})},{match:/^atom-pl-(\d+)$/,action:([,t])=>({"padding-left":`${t*4}px`})},{match:/^atom-m-(\d+)$/,action:([,t])=>({margin:`${t*4}px`})},{match:/^atom-mx-(\d+)$/,action:([,t])=>({"margin-left":`${t*4}px`,"margin-right":`${t*4}px`})},{match:/^atom-my-(\d+)$/,action:([,t])=>({"margin-top":`${t*4}px`,"margin-bottom":`${t*4}px`})},{match:/^atom-mt-(\d+)$/,action:([,t])=>({"margin-top":`${t*4}px`})},{match:/^atom-mr-(\d+)$/,action:([,t])=>({"margin-right":`${t*4}px`})},{match:/^atom-mb-(\d+)$/,action:([,t])=>({"margin-bottom":`${t*4}px`})},{match:/^atom-ml-(\d+)$/,action:([,t])=>({"margin-left":`${t*4}px`})},{match:/^atom-w-(\d+)$/,action:([,t])=>({width:`${t*4}px`})},{match:/^atom-w-\[(.+)\]$/,action:([,t])=>({width:t})},{match:/^atom-h-(\d+)$/,action:([,t])=>({height:`${t*4}px`})},{match:/^atom-h-\[(.+)\]$/,action:([,t])=>({height:t})},{match:/^atom-max-w-(\d+)$/,action:([,t])=>({"max-width":`${t*4}px`})},{match:/^atom-max-w-\[(.+)\]$/,action:([,t])=>({"max-width":t})},{match:/^atom-max-h-(\d+)$/,action:([,t])=>({"max-height":`${t*4}px`})},{match:/^atom-max-h-\[(.+)\]$/,action:([,t])=>({"max-height":t})},{match:/^atom-min-w-(\d+)$/,action:([,t])=>({"min-width":`${t*4}px`})},{match:/^atom-min-w-\[(.+)\]$/,action:([,t])=>({"min-width":t})},{match:/^atom-min-h-(\d+)$/,action:([,t])=>({"min-height":`${t*4}px`})},{match:/^atom-min-h-\[(.+)\]$/,action:([,t])=>({"min-height":t})},{match:/^atom-(text|bg)-(black|white)$/,action:([,t,o])=>{let e=o==="black"?"#000000":"#ffffff";return t==="text"?{color:e}:{"background-color":e}}},{match:/^atom-text-([a-z]+)-(\d{2,3})$/,action:([,t,o])=>n[t]?.[o]?{color:n[t][o]}:null},{match:/^atom-bg-([a-z]+)-(\d{2,3})$/,action:([,t,o])=>n[t]?.[o]?{"background-color":n[t][o]}:null},{match:/^atom-text-\[(.+)\]$/,action:([,t])=>/^(#|rgb|hsl|transparent|currentColor)/.test(t)?{color:t}:{"font-size":t}},{match:/^atom-bg-\[(.+)\]$/,action:([,t])=>({"background-color":t})},{match:/^atom-font-\[(\d+)\]$/,action:([,t])=>({"font-weight":t})},{match:/^atom-border-(\d+)$/,action:([,t])=>({"border-width":`${t}px`})},{match:/^atom-border-([a-z]+)-(\d{2,3})$/,action:([,t,o])=>n[t]?.[o]?{"border-color":n[t][o]}:null},{match:/^atom-border-\[(.+)\]$/,action:([,t])=>({"border-color":t})},{match:/^atom-rounded-\[(.+)\]$/,action:([,t])=>({"border-radius":t})},{match:/^atom-gap-(\d+)$/,action:([,t])=>({gap:`${t*4}px`})},{match:/^atom-grid-cols-(\d+)$/,action:([,t])=>({"grid-template-columns":`repeat(${t}, minmax(0, 1fr))`})},{match:/^atom-grid-rows-(\d+)$/,action:([,t])=>({"grid-template-rows":`repeat(${t}, minmax(0, 1fr))`})},{match:/^atom-top-(\d+)$/,action:([,t])=>({top:`${t*4}px`})},{match:/^atom-right-(\d+)$/,action:([,t])=>({right:`${t*4}px`})},{match:/^atom-bottom-(\d+)$/,action:([,t])=>({bottom:`${t*4}px`})},{match:/^atom-left-(\d+)$/,action:([,t])=>({left:`${t*4}px`})},{match:/^atom-top-\[(.+)\]$/,action:([,t])=>({top:t})},{match:/^atom-left-\[(.+)\]$/,action:([,t])=>({left:t})},{match:/^atom-right-\[(.+)\]$/,action:([,t])=>({right:t})},{match:/^atom-bottom-\[(.+)\]$/,action:([,t])=>({bottom:t})},{match:/^atom-z-(\d+)$/,action:([,t])=>({"z-index":t})},{match:/^atom-z-\[(.+)\]$/,action:([,t])=>({"z-index":t})},{match:/^atom-duration-(\d+)$/,action:([,t])=>({"transition-duration":`${t}ms`})}];function h(t){for(let o of C){let e=t.match(o.match);if(e)return o.action(e)}return null}function m(t){Array.from(t.classList).forEach(e=>{if(f.has(e))return;let a="",i=e;if(e.includes(":")){let s=e.split(":");i=s[s.length-1],a=s[0]}if(!i.startsWith("atom-"))return;let c=E(i);Object.keys(c).length>0&&(A(e,c,a),f.add(e))})}function A(t,o,e){let a=`.${CSS.escape(t)}`;["hover","focus","active","disabled"].includes(e)&&(a+=`:${e}`),a+=" { ";for(let[i,c]of Object.entries(o))a+=`${i}: ${c}; `;a+=`}
|
|
2
|
+
`,b(a)}function E(t){if(d[t])return{...d[t]};let o=h(t);return o?{...o}:{}}function p(t,o){if(!t.startsWith("atom-"))throw new Error(`liveAtom: Custom class "${t}" must start with "atom-"`);d[t]=o,document.querySelectorAll(`[class~="${t}"]`).forEach(e=>{m(e)})}function u(t){t.nodeType===1&&t.classList?.length&&[...t.classList].some(e=>e.includes("atom-"))&&m(t),t.querySelectorAll&&t.querySelectorAll('[class*="atom-"]').forEach(m)}function g(){new MutationObserver(o=>{o.forEach(e=>{e.addedNodes.length&&e.addedNodes.forEach(a=>{a.nodeType===1&&u(a)}),e.type==="attributes"&&e.attributeName==="class"&&m(e.target)})}).observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]})}function D(){if(document.getElementById("atom-live-reset"))return;let t=document.createElement("style");t.id="atom-live-reset",t.textContent=`
|
|
3
|
+
*, ::after, ::before, ::backdrop, ::file-selector-button {
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
border: 0 solid;
|
|
6
|
+
margin: 0;
|
|
7
|
+
padding: 0;
|
|
8
|
+
}
|
|
9
|
+
html {
|
|
10
|
+
line-height: 1.5;
|
|
11
|
+
-webkit-text-size-adjust: 100%;
|
|
12
|
+
tab-size: 4;
|
|
13
|
+
font-family: ui-sans-serif, system-ui, sans-serif;
|
|
14
|
+
}
|
|
15
|
+
body { line-height: inherit; cursor: default; -webkit-font-smoothing: antialiased; }
|
|
16
|
+
h1, h2, h3, h4, h5, h6 { font-size: inherit; font-weight: inherit; }
|
|
17
|
+
input, button, textarea, select { font: inherit; color: inherit; }
|
|
18
|
+
textarea { resize: vertical; }
|
|
19
|
+
button { all: unset; cursor: pointer; }
|
|
20
|
+
button:focus-visible { outline: auto; }
|
|
21
|
+
a { color: inherit; text-decoration: inherit; }
|
|
22
|
+
ol, ul { list-style: none; }
|
|
23
|
+
img, svg, video, canvas, audio, iframe, embed, object { display: block; vertical-align: middle; }
|
|
24
|
+
img, video { max-width: 100%; height: auto; }
|
|
25
|
+
table { border-collapse: collapse; }
|
|
26
|
+
b, strong { font-weight: bolder; }
|
|
27
|
+
code, pre { font-family: ui-monospace, monospace; }
|
|
28
|
+
`,document.head.appendChild(t)}function x(){function t(){D(),u(document.body),g()}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):t()}x();var R={init:x,addClass:p};var M=R;return j(L);})();
|
package/main.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "live-atom",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "A lightweight runtime css library inspired by tailwind css.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"css",
|
|
@@ -23,7 +23,21 @@
|
|
|
23
23
|
"exports": {
|
|
24
24
|
".": "./main.js"
|
|
25
25
|
},
|
|
26
|
+
"unpkg": "cdn.js",
|
|
27
|
+
"jsdelivr": "cdn.js",
|
|
28
|
+
"files": [
|
|
29
|
+
"main.js",
|
|
30
|
+
"cdn.js",
|
|
31
|
+
"domWatcher.js",
|
|
32
|
+
"styleManager.js",
|
|
33
|
+
"dynamicParser.js",
|
|
34
|
+
"styleMap.js",
|
|
35
|
+
"styleSheet.js"
|
|
36
|
+
],
|
|
26
37
|
"scripts": {
|
|
27
|
-
"
|
|
38
|
+
"build": "esbuild main.js --bundle --format=iife --global-name=liveAtom --minify --outfile=cdn.js"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"esbuild": "^0.28.0"
|
|
28
42
|
}
|
|
29
43
|
}
|