jq79 0.3.21 → 0.3.23
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/README.md +4 -1
- package/assets/code-coverage.svg +19 -0
- package/assets/github-dark.svg +5 -0
- package/assets/github-light.svg +5 -0
- package/assets/github-white.afdesign +0 -0
- package/assets/npm-logo.svg +8 -0
- package/dist/jq79.cjs +8 -8
- package/dist/jq79.cjs.map +1 -1
- package/dist/jq79.d.ts +4 -0
- package/dist/jq79.global.js +8 -8
- package/dist/jq79.global.js.map +1 -1
- package/dist/jq79.js +8 -8
- package/dist/jq79.js.map +1 -1
- package/dist/vite.cjs +38 -3
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.js +38 -3
- package/dist/vite.js.map +1 -1
- package/package.json +4 -1
- package/src/jq79.ts +169 -19
- package/src/reactive.ts +75 -29
- package/src/transform.ts +34 -4
- package/src/vite.ts +71 -7
package/README.md
CHANGED
|
@@ -14,6 +14,8 @@ A mini reactive component library that ships as a single file. Svelte-style reac
|
|
|
14
14
|
|
|
15
15
|
> no compiler required, no virtual DOM, no dependencies.
|
|
16
16
|
|
|
17
|
+
**[Take the tutorial →](https://jgermade.github.io/jq79/tutorial/)** — a handful of exercises you edit in the browser, with a live preview. Because there's no compiler, the tutorial runs the real library: the component you write is the component that mounts.
|
|
18
|
+
|
|
17
19
|
## Installation
|
|
18
20
|
|
|
19
21
|
### npm
|
|
@@ -105,7 +107,8 @@ When the fetch resolves, the assignments to `firstName`/`lastName` re-run the `$
|
|
|
105
107
|
|
|
106
108
|
## Documentation
|
|
107
109
|
|
|
108
|
-
- [
|
|
110
|
+
- [Tutorial](https://jgermade.github.io/jq79/tutorial/) — learn it by doing, in the browser.
|
|
111
|
+
- [Components](docs/components.md) — lifecycle (`mount`, `mountShadow`, `detach`, `destroy`), instance events (`on`/`off`), `<style scoped>`, loading remote components with `Component79.fetch`.
|
|
109
112
|
- [Template syntax](docs/template-syntax.md) — `{{ }}` interpolation, `:attrs`, `:text`/`:html`, `:if`/`:elseif`/`:else`, `:each`/`:key`, `:with`, `@event` listeners and modifiers, nested components.
|
|
110
113
|
- [Setup scripts](docs/setup-scripts.md) — `<script :setup>` reactive scripts, `$:` declarations, `$emit`, `await $mounted()`, `$self`/`$$self`, and `export default` factory scripts (plain-JS alternative).
|
|
111
114
|
- [Reactive data](docs/reactive-data.md) — the standalone `$reactive` store: `$on`, `$onAny`, `$effect`.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
3
|
+
<svg width="100%" height="100%" viewBox="0 0 240 240" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
|
4
|
+
<g transform="matrix(1,0,0,1,4.29914,3.85266)">
|
|
5
|
+
<circle cx="115.701" cy="116.147" r="90.609" style="fill:rgb(235,235,235);"/>
|
|
6
|
+
</g>
|
|
7
|
+
<path d="M120,13C179.055,13 227,60.945 227,120C227,179.055 179.055,227 120,227C60.945,227 13,179.055 13,120C13,60.945 60.945,13 120,13ZM120,47C79.71,47 47,79.71 47,120C47,160.29 79.71,193 120,193C160.29,193 193,160.29 193,120C193,79.71 160.29,47 120,47Z" style="fill:rgb(238,240,242);"/>
|
|
8
|
+
<g transform="matrix(-3.82857e-16,-1,1,-3.82857e-16,4.26326e-14,240)">
|
|
9
|
+
<path d="M14.54,101.841L14.541,101.831C23.187,51.421 67.139,13 120,13C179.055,13 227,60.945 227,120C227,179.055 179.055,227 120,227C60.945,227 13,179.055 13,120C13,113.811 13.528,107.743 14.54,101.841ZM48.052,107.578L48.051,107.585C47.359,111.62 47,115.768 47,120C47,160.29 79.71,193 120,193C160.29,193 193,160.29 193,120C193,79.71 160.29,47 120,47C83.943,47 53.949,73.193 48.052,107.578Z" style="fill:rgb(34,197,94);"/>
|
|
10
|
+
<g transform="matrix(1.00052,0,0,1,-0.0156662,-6.62052e-15)">
|
|
11
|
+
<path d="M120,47.004L119.987,47.004C84.495,47.011 54.878,72.39 48.34,105.983L14.976,99.482C24.561,50.238 67.952,13.005 119.981,12.996L120,12.996L120,47.004Z" style="fill:rgb(239,68,68);"/>
|
|
12
|
+
</g>
|
|
13
|
+
</g>
|
|
14
|
+
<g transform="matrix(2.17089,0,0,2.17089,120.338,163.405)">
|
|
15
|
+
<g transform="matrix(58,0,0,58,-25.7856,0)">
|
|
16
|
+
<path d="M0.498,-0.167C0.498,-0.218 0.515,-0.261 0.551,-0.296C0.586,-0.332 0.629,-0.349 0.679,-0.349C0.729,-0.349 0.772,-0.331 0.808,-0.296C0.843,-0.26 0.861,-0.218 0.861,-0.167C0.861,-0.117 0.843,-0.075 0.808,-0.039C0.772,-0.004 0.729,0.014 0.679,0.014C0.629,0.014 0.586,-0.004 0.551,-0.039C0.515,-0.075 0.498,-0.117 0.498,-0.167ZM0.076,-0.395C0.041,-0.43 0.023,-0.473 0.023,-0.523C0.023,-0.573 0.041,-0.616 0.076,-0.651C0.112,-0.687 0.154,-0.705 0.205,-0.705C0.255,-0.705 0.298,-0.687 0.333,-0.651C0.368,-0.616 0.386,-0.573 0.386,-0.523C0.386,-0.473 0.369,-0.43 0.333,-0.395C0.298,-0.359 0.255,-0.341 0.205,-0.341C0.154,-0.341 0.112,-0.359 0.076,-0.395ZM0.281,0.019L0.206,0.019L0.602,-0.708L0.676,-0.708L0.281,0.019ZM0.625,-0.113C0.639,-0.097 0.658,-0.09 0.679,-0.09C0.701,-0.09 0.719,-0.097 0.734,-0.113C0.749,-0.128 0.757,-0.146 0.757,-0.167C0.757,-0.189 0.749,-0.207 0.734,-0.222C0.719,-0.238 0.701,-0.245 0.679,-0.245C0.658,-0.245 0.639,-0.238 0.624,-0.222C0.609,-0.207 0.602,-0.189 0.602,-0.167C0.602,-0.146 0.609,-0.128 0.625,-0.113ZM0.15,-0.468C0.165,-0.453 0.183,-0.445 0.205,-0.445C0.226,-0.445 0.244,-0.453 0.26,-0.468C0.275,-0.483 0.282,-0.501 0.282,-0.523C0.282,-0.544 0.275,-0.563 0.26,-0.578C0.244,-0.593 0.226,-0.601 0.205,-0.601C0.183,-0.601 0.165,-0.593 0.15,-0.578C0.135,-0.563 0.127,-0.544 0.127,-0.523C0.127,-0.501 0.135,-0.483 0.15,-0.468Z" style="fill:rgb(31,41,55);fill-rule:nonzero;"/>
|
|
17
|
+
</g>
|
|
18
|
+
</g>
|
|
19
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2" viewBox="0 0 3500 820">
|
|
2
|
+
<path d="M92.375 230.65H52.019a1.897 1.897 0 0 0-1.886 1.886v19.731a1.9 1.9 0 0 0 1.886 1.889h15.743v24.513s-3.535 1.206-13.308 1.206c-11.53 0-27.637-4.214-27.637-39.632 0-35.425 16.772-40.087 32.518-40.087 13.63 0 19.502 2.401 23.238 3.556 1.174.36 2.26-.808 2.26-1.851l4.502-19.063c0-.487-.165-1.075-.721-1.474-1.517-1.082-10.774-6.262-34.16-6.262-26.941 0-54.576 11.463-54.576 66.562 0 55.103 31.64 63.313 58.302 63.313 22.076 0 35.468-9.434 35.468-9.434.552-.306.612-1.077.612-1.431v-61.537c0-1.04-.844-1.885-1.885-1.885m207.979-48.986v-.016a1.89 1.89 0 0 0-1.873-1.88h-22.724a1.9 1.9 0 0 0-1.882 1.889v.007l.006 43.913h-35.419V181.65a1.89 1.89 0 0 0-1.875-1.882h-22.722a1.895 1.895 0 0 0-1.877 1.896v118.904c0 1.048.843 1.901 1.877 1.901h22.722c1.039 0 1.875-.854 1.875-1.901v-50.86h35.419l-.062 50.86c0 1.048.844 1.901 1.883 1.901h22.777c1.041 0 1.873-.854 1.875-1.901zm-165.1 15.604c0-8.183-6.56-14.795-14.653-14.795-8.085 0-14.65 6.612-14.65 14.795 0 8.173 6.565 14.802 14.65 14.802 8.093 0 14.653-6.629 14.653-14.802m-1.625 78.218V220.6a1.9 1.9 0 0 0-1.88-1.895h-22.651c-1.039 0-1.969 1.072-1.969 2.115v78.634c0 2.312 1.44 2.998 3.304 2.998h20.408c2.239 0 2.788-1.1 2.788-3.034zm253.081-56.602h-22.549c-1.034 0-1.876.852-1.876 1.901v58.302s-5.729 4.192-13.859 4.192-10.287-3.689-10.287-11.65v-50.844c0-1.049-.841-1.901-1.875-1.901h-22.886c-1.032 0-1.879.852-1.879 1.901v54.693c0 23.646 13.179 29.431 31.31 29.431 14.873 0 26.864-8.216 26.864-8.216s.571 4.329.829 4.843c.259.512.932 1.029 1.659 1.029l14.56-.064c1.032 0 1.879-.854 1.879-1.898l-.008-79.817c0-1.05-.843-1.902-1.882-1.902m52.735 64.323c-7.821-.238-13.126-3.788-13.126-3.788v-37.653s5.233-3.208 11.654-3.782c8.12-.727 15.944 1.726 15.944 21.095.001 20.426-3.53 24.457-14.472 24.128m8.894-66.993c-12.807 0-21.518 5.714-21.518 5.714v-40.263c0-1.05-.839-1.897-1.875-1.897h-22.787a1.896 1.896 0 0 0-1.878 1.887v118.913c0 1.048.842 1.901 1.881 1.901h15.811c.711 0 1.25-.367 1.648-1.009.393-.639.96-5.482.96-5.482s9.318 8.83 26.957 8.83c20.708 0 32.584-10.504 32.584-47.154s-18.967-41.44-31.783-41.44m-249.403 2.481h-17.045l-.026-22.519c0-.852-.439-1.278-1.424-1.278h-23.228c-.903 0-1.388.398-1.388 1.265v23.271s-11.64 2.809-12.427 3.037a1.89 1.89 0 0 0-1.361 1.812v14.623c0 1.052.84 1.898 1.879 1.898h11.909v35.178c0 26.13 18.328 28.697 30.696 28.697 5.651 0 12.411-1.814 13.527-2.228.675-.248 1.067-.947 1.067-1.705l.019-16.086c0-1.05-.886-1.897-1.884-1.897-.993 0-3.534.404-6.15.404-8.372 0-11.209-3.893-11.209-8.932l-.001-33.432h17.046c1.039 0 1.88-.847 1.88-1.898v-18.326a1.893 1.893 0 0 0-1.88-1.884" style="fill:#121110;fill-rule:nonzero" transform="translate(995.503 -839.199)scale(5.205)"/>
|
|
3
|
+
<path d="M127.505 0C57.095 0 0 57.085 0 127.505c0 56.336 36.534 104.13 87.196 120.99 6.372 1.18 8.712-2.766 8.712-6.134 0-3.04-.119-13.085-.173-23.739-35.473 7.713-42.958-15.044-42.958-15.044-5.8-14.738-14.157-18.656-14.157-18.656-11.568-7.914.872-7.752.872-7.752 12.804.9 19.546 13.14 19.546 13.14 11.372 19.493 29.828 13.857 37.104 10.6 1.144-8.242 4.449-13.866 8.095-17.05-28.32-3.225-58.092-14.158-58.092-63.014 0-13.92 4.981-25.295 13.138-34.224-1.324-3.212-5.688-16.18 1.235-33.743 0 0 10.707-3.427 35.073 13.07 10.17-2.826 21.078-4.242 31.914-4.29 10.836.048 21.752 1.464 31.942 4.29 24.337-16.497 35.029-13.07 35.029-13.07 6.94 17.563 2.574 30.531 1.25 33.743 8.175 8.929 13.122 20.303 13.122 34.224 0 48.972-29.828 59.756-58.22 62.912 4.573 3.957 8.648 11.717 8.648 23.612 0 17.06-.148 30.791-.148 34.991 0 3.393 2.295 7.369 8.759 6.117 50.634-16.879 87.122-64.656 87.122-120.973C255.009 57.085 197.922 0 127.505 0" style="fill:#161614;fill-rule:nonzero" transform="translate(4.6 18.364)scale(3.09396)"/>
|
|
4
|
+
<path d="M47.755 181.634c-.28.633-1.278.823-2.185.389-.925-.416-1.445-1.28-1.145-1.916.275-.652 1.273-.834 2.196-.396.927.415 1.455 1.287 1.134 1.923m6.272 5.596c-.608.564-1.797.302-2.604-.589-.834-.889-.99-2.077-.373-2.65.627-.563 1.78-.3 2.616.59.834.899.996 2.08.36 2.65m4.304 7.159c-.782.543-2.06.034-2.849-1.1-.781-1.133-.781-2.493.017-3.038.792-.545 2.05-.055 2.85 1.07.78 1.153.78 2.513-.019 3.069m7.277 8.292c-.699.77-2.187.564-3.277-.488-1.114-1.028-1.425-2.487-.724-3.258.707-.772 2.204-.555 3.302.488 1.107 1.026 1.445 2.496.7 3.258m9.403 2.8c-.307.998-1.741 1.452-3.185 1.028-1.442-.437-2.386-1.607-2.095-2.616.3-1.005 1.74-1.478 3.195-1.024 1.44.435 2.386 1.596 2.086 2.612m10.703 1.187c.036 1.052-1.189 1.924-2.705 1.943-1.525.033-2.758-.818-2.774-1.852 0-1.062 1.197-1.926 2.721-1.951 1.516-.03 2.758.815 2.758 1.86m10.514-.403c.182 1.026-.872 2.08-2.377 2.36-1.48.27-2.85-.363-3.039-1.38-.184-1.052.89-2.105 2.367-2.378 1.508-.262 2.857.355 3.049 1.398" style="fill:#161614;fill-rule:nonzero" transform="translate(4.6 18.364)scale(3.09396)"/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2" viewBox="0 0 3500 820">
|
|
2
|
+
<path d="M92.375 230.65H52.019a1.897 1.897 0 0 0-1.886 1.886v19.731a1.9 1.9 0 0 0 1.886 1.889h15.743v24.513s-3.535 1.206-13.308 1.206c-11.53 0-27.637-4.214-27.637-39.632 0-35.425 16.772-40.087 32.518-40.087 13.63 0 19.502 2.401 23.238 3.556 1.174.36 2.26-.808 2.26-1.851l4.502-19.063c0-.487-.165-1.075-.721-1.474-1.517-1.082-10.774-6.262-34.16-6.262-26.941 0-54.576 11.463-54.576 66.562 0 55.103 31.64 63.313 58.302 63.313 22.076 0 35.468-9.434 35.468-9.434.552-.306.612-1.077.612-1.431v-61.537c0-1.04-.844-1.885-1.885-1.885m207.979-48.986v-.016a1.89 1.89 0 0 0-1.873-1.88h-22.724a1.9 1.9 0 0 0-1.882 1.889v.007l.006 43.913h-35.419V181.65a1.89 1.89 0 0 0-1.875-1.882h-22.722a1.895 1.895 0 0 0-1.877 1.896v118.904c0 1.048.843 1.901 1.877 1.901h22.722c1.039 0 1.875-.854 1.875-1.901v-50.86h35.419l-.062 50.86c0 1.048.844 1.901 1.883 1.901h22.777c1.041 0 1.873-.854 1.875-1.901zm-165.1 15.604c0-8.183-6.56-14.795-14.653-14.795-8.085 0-14.65 6.612-14.65 14.795 0 8.173 6.565 14.802 14.65 14.802 8.093 0 14.653-6.629 14.653-14.802m-1.625 78.218V220.6a1.9 1.9 0 0 0-1.88-1.895h-22.651c-1.039 0-1.969 1.072-1.969 2.115v78.634c0 2.312 1.44 2.998 3.304 2.998h20.408c2.239 0 2.788-1.1 2.788-3.034zm253.081-56.602h-22.549c-1.034 0-1.876.852-1.876 1.901v58.302s-5.729 4.192-13.859 4.192-10.287-3.689-10.287-11.65v-50.844c0-1.049-.841-1.901-1.875-1.901h-22.886c-1.032 0-1.879.852-1.879 1.901v54.693c0 23.646 13.179 29.431 31.31 29.431 14.873 0 26.864-8.216 26.864-8.216s.571 4.329.829 4.843c.259.512.932 1.029 1.659 1.029l14.56-.064c1.032 0 1.879-.854 1.879-1.898l-.008-79.817c0-1.05-.843-1.902-1.882-1.902m52.735 64.323c-7.821-.238-13.126-3.788-13.126-3.788v-37.653s5.233-3.208 11.654-3.782c8.12-.727 15.944 1.726 15.944 21.095.001 20.426-3.53 24.457-14.472 24.128m8.894-66.993c-12.807 0-21.518 5.714-21.518 5.714v-40.263c0-1.05-.839-1.897-1.875-1.897h-22.787a1.896 1.896 0 0 0-1.878 1.887v118.913c0 1.048.842 1.901 1.881 1.901h15.811c.711 0 1.25-.367 1.648-1.009.393-.639.96-5.482.96-5.482s9.318 8.83 26.957 8.83c20.708 0 32.584-10.504 32.584-47.154s-18.967-41.44-31.783-41.44m-249.403 2.481h-17.045l-.026-22.519c0-.852-.439-1.278-1.424-1.278h-23.228c-.903 0-1.388.398-1.388 1.265v23.271s-11.64 2.809-12.427 3.037a1.89 1.89 0 0 0-1.361 1.812v14.623c0 1.052.84 1.898 1.879 1.898h11.909v35.178c0 26.13 18.328 28.697 30.696 28.697 5.651 0 12.411-1.814 13.527-2.228.675-.248 1.067-.947 1.067-1.705l.019-16.086c0-1.05-.886-1.897-1.884-1.897-.993 0-3.534.404-6.15.404-8.372 0-11.209-3.893-11.209-8.932l-.001-33.432h17.046c1.039 0 1.88-.847 1.88-1.898v-18.326a1.893 1.893 0 0 0-1.88-1.884" style="fill:#e2e2e2;fill-rule:nonzero" transform="translate(974.94 -839.199)scale(5.205)"/>
|
|
3
|
+
<path d="M127.505 0C57.095 0 0 57.085 0 127.505c0 56.336 36.534 104.13 87.196 120.99 6.372 1.18 8.712-2.766 8.712-6.134 0-3.04-.119-13.085-.173-23.739-35.473 7.713-42.958-15.044-42.958-15.044-5.8-14.738-14.157-18.656-14.157-18.656-11.568-7.914.872-7.752.872-7.752 12.804.9 19.546 13.14 19.546 13.14 11.372 19.493 29.828 13.857 37.104 10.6 1.144-8.242 4.449-13.866 8.095-17.05-28.32-3.225-58.092-14.158-58.092-63.014 0-13.92 4.981-25.295 13.138-34.224-1.324-3.212-5.688-16.18 1.235-33.743 0 0 10.707-3.427 35.073 13.07 10.17-2.826 21.078-4.242 31.914-4.29 10.836.048 21.752 1.464 31.942 4.29 24.337-16.497 35.029-13.07 35.029-13.07 6.94 17.563 2.574 30.531 1.25 33.743 8.175 8.929 13.122 20.303 13.122 34.224 0 48.972-29.828 59.756-58.22 62.912 4.573 3.957 8.648 11.717 8.648 23.612 0 17.06-.148 30.791-.148 34.991 0 3.393 2.295 7.369 8.759 6.117 50.634-16.879 87.122-64.656 87.122-120.973C255.009 57.085 197.922 0 127.505 0" style="fill:#e2e2e2;fill-rule:nonzero" transform="translate(28.199 18.364)scale(3.09396)"/>
|
|
4
|
+
<path d="M47.755 181.634c-.28.633-1.278.823-2.185.389-.925-.416-1.445-1.28-1.145-1.916.275-.652 1.273-.834 2.196-.396.927.415 1.455 1.287 1.134 1.923m6.272 5.596c-.608.564-1.797.302-2.604-.589-.834-.889-.99-2.077-.373-2.65.627-.563 1.78-.3 2.616.59.834.899.996 2.08.36 2.65m4.304 7.159c-.782.543-2.06.034-2.849-1.1-.781-1.133-.781-2.493.017-3.038.792-.545 2.05-.055 2.85 1.07.78 1.153.78 2.513-.019 3.069m7.277 8.292c-.699.77-2.187.564-3.277-.488-1.114-1.028-1.425-2.487-.724-3.258.707-.772 2.204-.555 3.302.488 1.107 1.026 1.445 2.496.7 3.258m9.403 2.8c-.307.998-1.741 1.452-3.185 1.028-1.442-.437-2.386-1.607-2.095-2.616.3-1.005 1.74-1.478 3.195-1.024 1.44.435 2.386 1.596 2.086 2.612m10.703 1.187c.036 1.052-1.189 1.924-2.705 1.943-1.525.033-2.758-.818-2.774-1.852 0-1.062 1.197-1.926 2.721-1.951 1.516-.03 2.758.815 2.758 1.86m10.514-.403c.182 1.026-.872 2.08-2.377 2.36-1.48.27-2.85-.363-3.039-1.38-.184-1.052.89-2.105 2.367-2.378 1.508-.262 2.857.355 3.049 1.398" style="fill:#e2e2e2;fill-rule:nonzero" transform="translate(28.199 18.364)scale(3.09396)"/>
|
|
5
|
+
</svg>
|
|
Binary file
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
3
|
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="540px" height="210px" viewBox="0 0 18 7">
|
|
4
|
+
<path fill="#CB3837" d="M0,0h18v6H9v1H5V6H0V0z M1,5h2V2h1v3h1V1H1V5z M6,1v5h2V5h2V1H6z M8,2h1v2H8V2z M11,1v4h2V2h1v3h1V2h1v3h1V1H11z"/>
|
|
5
|
+
<polygon fill="#FFFFFF" points="1,5 3,5 3,2 4,2 4,5 5,5 5,1 1,1 "/>
|
|
6
|
+
<path fill="#FFFFFF" d="M6,1v5h2V5h2V1H6z M9,4H8V2h1V4z"/>
|
|
7
|
+
<polygon fill="#FFFFFF" points="11,1 11,5 13,5 13,2 14,2 14,5 15,5 15,2 16,2 16,5 17,5 17,1 "/>
|
|
8
|
+
</svg>
|
package/dist/jq79.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
`,e);return n===-1?t.length:n},
|
|
3
|
-
|
|
4
|
-
`||
|
|
5
|
-
`||c===";"||c==="}"?
|
|
1
|
+
var j=Object.defineProperty;var bt=Object.getOwnPropertyDescriptor;var $t=Object.getOwnPropertyNames;var wt=Object.prototype.hasOwnProperty;var Rt=(t,e,n)=>e in t?j(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var xt=(t,e)=>{for(var n in e)j(t,n,{get:e[n],enumerable:!0})},Tt=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of $t(e))!wt.call(t,r)&&r!==n&&j(t,r,{get:()=>e[r],enumerable:!(s=bt(e,r))||s.enumerable});return t};var Ct=t=>Tt(j({},"__esModule",{value:!0}),t);var w=(t,e,n)=>Rt(t,typeof e!="symbol"?e+"":e,n);var oe={};xt(oe,{$:()=>v,$$:()=>M,$create:()=>D,$reactive:()=>O,Component79:()=>L,parseComponent:()=>re,renderComponent:()=>Ht});module.exports=Ct(oe);function v(t,e){return typeof t=="string"?document.querySelector(t):t.querySelector(e)}function M(t,e){return Array.from(typeof t=="string"?document.querySelectorAll(t):t.querySelectorAll(e))}var D=(t,e={})=>{let n=document.createElement(t);for(let[s,r]of Object.entries(e))if(s==="className")n.className=Array.isArray(r)?r.join(" "):r;else if(s==="textContent")n.textContent=r;else if(s==="children")for(let o of r)n.appendChild(o);else n.setAttribute(s,r);return n},Nt=new Set(["a","b","i","em","strong","p","br","ul","ol","li","blockquote","code","pre","span","div","h1","h2","h3","h4","h5","h6","img"]),Z={a:new Set(["href","title"]),img:new Set(["src","alt"]),"*":new Set(["class"])},Lt=new Set(["http:","https:","mailto:"]);function vt(t){try{let e=new URL(t,"https://example.com");return Lt.has(e.protocol)}catch{return!1}}function X(t,e){for(let n of Array.from(t.childNodes))if(n.nodeType===Node.ELEMENT_NODE){let s=_t(n);s&&e.appendChild(s)}else n.nodeType===Node.TEXT_NODE&&e.appendChild(n.cloneNode())}function _t(t){let e=t.tagName.toLowerCase();if(!Nt.has(e))return null;let n=document.createElement(e);for(let s of Array.from(t.attributes)){let r=s.name.toLowerCase(),o=Z[e]?.has(r),i=Z["*"]?.has(r);!o&&!i||(r==="href"||r==="src")&&!vt(s.value)||n.setAttribute(r,s.value)}return e==="a"&&n.setAttribute("rel","noopener noreferrer"),X(t,n),n}function J(t){let e=new DOMParser().parseFromString(t,"text/html"),n=document.createElement("div");return X(e.body,n),n.innerHTML}var At=(t,e)=>e.split(".").reduce((n,s)=>n?.[s],t),Y=t=>{if(Array.isArray(t))return!0;let e=Object.getPrototypeOf(t);return e===Object.prototype||e===null},Q=(t,e,n)=>{Object.entries(t).forEach(([s,r])=>{let o=e?`${e}.${s}`:s;r&&typeof r=="object"&&Y(r)?Q(r,o,n):n(o,r)})},Ot=(t,e)=>t===e||t.startsWith(`${e}.`)||e.startsWith(`${t}.`),q=Symbol("jq79.raw"),I=t=>{let e=t;for(;e!==null&&typeof e=="object"&&e[q];)e=e[q];return e},tt=Symbol("jq79.store"),W=t=>t!==null&&typeof t=="object"&&t[tt]===!0,_=[],et=t=>{_.push(new Set);try{return t()}finally{_.pop()}},O=t=>{let e=new Map,n=new Set,s=new Set,r=new WeakMap,o=Object.create(null),i=(u,d,b=!1)=>{e.get(u)?.forEach(S=>S(d,u)),n.forEach(S=>S(u,d)),s.forEach(S=>{(b||Array.from(S.deps).some(f=>Ot(f,u)))&&S.run()})},c=u=>u!==null&&typeof u=="object"&&Y(u),l=(u,d)=>{let b=r.get(u);if(b)return b;let S=new Proxy(u,{get(f,m,E){if(m===q)return f;if(m===tt)return d==="";if(typeof m!="string")return Reflect.get(f,m,E);if(d===""&&m in o)return o[m];let g=d?`${d}.${m}`:m;_[_.length-1]?.add(g);let R=Reflect.get(f,m,E);if(W(R))return R;let $=I(R);return c($)?l($,g):$},set(f,m,E,g){if(g!==S&&!Object.prototype.hasOwnProperty.call(f,m))return Reflect.set(f,m,E,g);let R=d?`${d}.${m}`:m,$=W(E)?E:I(E),C=!Object.prototype.hasOwnProperty.call(f,m);f[m]=$;let T=W($)||!c($)?$:l($,R);return i(R,T,C),!0}});return r.set(u,S),S},h=l(I(t),""),a=(u,d,{immediate:b=!1}={})=>(e.has(u)||e.set(u,new Set),e.get(u).add(d),b&&d(At(h,u),u),()=>e.get(u)?.delete(d)),p=(u,{immediate:d=!1}={})=>(n.add(u),d&&Q(h,"",(b,S)=>u(b,S)),()=>n.delete(u)),y=u=>{let d={deps:new Set,run:()=>{let b=new Set;_.push(b);try{u()}finally{_.pop(),d.deps=b}}};return s.add(d),d.run(),()=>{s.delete(d)}};return o.$on=a,o.$onAny=p,o.$effect=y,h},A=t=>{let e=[];return{effect:n=>{e.push(t.$effect(n))},onDispose:n=>{e.push(n)},dispose:()=>{e.splice(0).forEach(n=>n())}}};var nt=/(?:let|var|const)\s+([A-Za-z_$][\w$]*)/y,st=/\$:\s*/y,k=/import(?=\s*\()/y,rt=/\$:\s*([A-Za-z_$][\w$]*)\s*=(?!=)/y,U=(t,e)=>{let n=t[e],s=e+1;for(;s<t.length;){if(t[s]==="\\"){s+=2;continue}if(t[s]===n)return s+1;s++}return t.length},P=(t,e)=>{let n=t.indexOf(`
|
|
2
|
+
`,e);return n===-1?t.length:n},F=(t,e)=>{let n=t.indexOf("*/",e+2);return n===-1?t.length:n+2},jt=(t,e)=>{let n=e;for(;n<t.length;){if(/\s/.test(t[n])){n++;continue}if(t[n]==="/"&&t[n+1]==="/"){n=P(t,n);continue}if(t[n]==="/"&&t[n+1]==="*"){n=F(t,n);continue}break}return n},Mt=/^(\?\.|\?\?|&&|\|\||\*\*|[.,+\-*/%&|^<>=?:([])/,Dt=(t,e)=>{let n=0,s=e;for(;s<t.length;){let r=t[s];if(r==="'"||r==='"'||r==="`"){s=U(t,s);continue}if(r==="/"&&t[s+1]==="/"){s=P(t,s);continue}if(r==="/"&&t[s+1]==="*"){s=F(t,s);continue}if("([{".includes(r))n++;else if(")]}".includes(r))n--;else{if(n<=0&&r===";")return s;if(n<=0&&r===`
|
|
3
|
+
`){let o=jt(t,s+1);if(o>=t.length||!Mt.test(t.slice(o,o+2)))return s;s=o;continue}}s++}return t.length},ct=t=>{let e=[],n="",s=0,r=0,o=!0;for(;s<t.length;){let i=t[s],c=t[s+1];if(i==="'"||i==='"'||i==="`"){let l=U(t,s);n+=t.slice(s,l),s=l,o=!1;continue}if(i==="/"&&(c==="/"||c==="*")){let l=c==="/"?P(t,s):F(t,s);n+=t.slice(s,l),s=l;continue}if(i==="i"&&(s===0||!/[\w$.]/.test(t[s-1]))&&(k.lastIndex=s,k.test(t))){n+="$__import",s+=6,o=!1;continue}if(r===0&&o){nt.lastIndex=s;let l=nt.exec(t);if(l){e.push(l[1]),n+=l[1],s+=l[0].length,o=!1;continue}st.lastIndex=s;let h=st.exec(t);if(h){rt.lastIndex=s;let a=rt.exec(t);a&&e.push(a[1]);let p=s+h[0].length,y=Dt(t,p);n+=`$__effect(() => { ${t.slice(p,y)} });`,s=y;continue}}"([{".includes(i)?r++:")]}".includes(i)&&(r=Math.max(0,r-1)),i===`
|
|
4
|
+
`||i===";"||i==="}"?o=!0:/\s/.test(i)||(o=!1),n+=i,s++}return{vars:e,code:n}},ot=/export\s+default(?![\w$])/y,it=/import\s*(?:([\w$\s,{}*]+?)\s*from\s*)?(["'])([^"'\n]+)\2/y,kt=t=>{let e=[],n=0,s=0;for(let r=0;r<=t.length;r++){let o=t[r];if(o==="{")n++;else if(o==="}")n--;else if(r===t.length||o===","&&n===0){let i=t.slice(s,r).trim();i&&e.push(i),s=r+1}}return e},Pt=(t,e,n)=>{let s=`await $__import(${JSON.stringify(e)})`;if(t===void 0)return s;let r=kt(t),o=[],i=s;if(r.length>1){let c=`$__mod${n}`;o.push(`${c} = ${s}`),i=c}for(let c of r)c.startsWith("{")?o.push(`${c.replace(/\s+as\s+/g,": ")} = ${i}`):c.startsWith("*")?o.push(`${c.replace(/^\*\s*as\s+/,"")} = ${i}`):o.push(`${c} = $__default(${i})`);return`const ${o.join(", ")}`},at=t=>{let e="",n=0,s=0,r=!0,o=!1,i=0;for(;n<t.length;){let c=t[n],l=t[n+1],h=n===0||!/[\w$.]/.test(t[n-1]);if(c==="'"||c==='"'||c==="`"){let a=U(t,n);e+=t.slice(n,a),n=a,r=!1;continue}if(c==="/"&&(l==="/"||l==="*")){let a=l==="/"?P(t,n):F(t,n);e+=t.slice(n,a),n=a;continue}if(c==="i"&&h){if(k.lastIndex=n,k.test(t)){e+="$__import",n+=6,r=!1;continue}if(s===0&&r){it.lastIndex=n;let a=it.exec(t);if(a){e+=Pt(a[1],a[3],i++),n+=a[0].length,r=!1;continue}}}if(c==="e"&&h&&s===0&&r){ot.lastIndex=n;let a=ot.exec(t);if(a){o=!0,e+="$__exports.default =",n+=a[0].length,r=!1;continue}}"([{".includes(c)?s++:")]}".includes(c)&&(s=Math.max(0,s-1)),c===`
|
|
5
|
+
`||c===";"||c==="}"?r=!0:/\s/.test(c)||(r=!1),e+=c,n++}return o?e:null};var pt=t=>Object.fromEntries(Array.from(t.attributes).map(e=>[e.name,e.value])),ht=t=>({tag:t.tagName.toLowerCase(),attrs:pt(t),children:Array.from(t.childNodes).flatMap(e=>{if(e.nodeType===Node.TEXT_NODE){let n=e.textContent?.trim()??"";return n?[n]:[]}return e.nodeType===Node.ELEMENT_NODE?[ht(e)]:[]})}),x=(t,e,n)=>{try{return new Function("$scope",...Object.keys(n??{}),`with ($scope) { return (${t}); }`)(e,...Object.values(n??{}))}catch{return}},Ft=(t,e)=>t.replace(/{{\s*([\s\S]+?)\s*}}/g,(n,s)=>x(s,e)??""),mt=new Set([":attrs",":if",":elseif",":else",":each",":key",":with",":text",":html"]),Bt=/^\s*(\w+)\s+in\s+([\s\S]+)$/,It=(t,e,n,s)=>{let[r,...o]=e.slice(1).split("."),i=new Set(o);t.addEventListener(r,c=>{if(i.has("self")&&c.target!==t)return;i.has("prevent")&&c.preventDefault(),i.has("stop")&&c.stopPropagation();let l=x(n,s,{$event:c});typeof l=="function"&&l.call(t,c)},{once:i.has("once"),capture:i.has("capture")})},lt=t=>t.replace(/-(\w)/g,(e,n)=>n.toUpperCase()),ft=(t,e)=>{let n=e.replace(/-/g,"").toLowerCase();for(let s=t;s&&s!==Object.prototype;s=Object.getPrototypeOf(s))for(let r of Object.keys(s))if(/^[A-Z]/.test(r)&&r.replace(/-/g,"").toLowerCase()===n)return r;return null},ut=(t,e,n,s)=>{let r=document.createComment(t),o=document.createDocumentFragment();o.appendChild(r);let i={};Object.entries(e.attrs).forEach(([a,p])=>{if(!(a===K||mt.has(a)||a.startsWith("@")))if(a.startsWith(":")){let y=lt(a.slice(1));i[y]=p||y}else i[lt(a)]=JSON.stringify(p)});let c=null,l=null,h=null;return s.effect(()=>{let a=x(t,n),p=a instanceof L?a:null;if(p===l||(h?.dispose(),h=null,c?.destroy(),c=null,l=p,!p))return;let y=new L({template:p.template,scripts:p.scripts,styles:p.styles,modules:p.modules,filename:p.filename}),u=et(()=>Object.fromEntries(Object.entries(i).map(([S,f])=>[S,x(f,n)]))),d=document.createDocumentFragment();y.render(u).mount(d),r.parentNode.insertBefore(d,r.nextSibling);let b=A(n);Object.entries(i).forEach(([S,f])=>{b.effect(()=>{y.data[S]=x(f,n)})}),h=b,c=y}),s.onDispose(()=>{h?.dispose(),c?.destroy()}),o},Wt=(t,e)=>{let n=()=>{let s=x(t,e);return s!==null&&typeof s=="object"?s:null};return new Proxy(e,{has(s,r){let o=n();return o!==null&&Reflect.has(o,r)||Reflect.has(s,r)},get(s,r){let o=n();return o!==null&&Reflect.has(o,r)?o[r]:Reflect.get(s,r)},set(s,r,o){let i=n();return i!==null&&Reflect.has(i,r)?(i[r]=o,!0):Reflect.set(s,r,o)}})},z=(t,e,n)=>{let s=t.attrs[":with"],r=s!==void 0?Wt(s,e):e,o=ft(r,t.tag);if(o)return ut(o,t,r,n);let i=document.createElement(t.tag);if(i instanceof HTMLUnknownElement||t.tag.includes("-")){let a=!1;n.effect(()=>{if(a)return;let p=ft(r,t.tag);p&&(a=!0,i.replaceWith(ut(p,t,r,n)))})}Object.entries(t.attrs).forEach(([a,p])=>{a.startsWith("@")?It(i,a,p,r):mt.has(a)||i.setAttribute(a,p)});let c=t.attrs[":attrs"];if(c!==void 0){let a=[];n.effect(()=>{a.forEach(y=>i.removeAttribute(y));let p=x(c,r);a=p&&typeof p=="object"?Object.keys(p):[],a.forEach(y=>{let u=p[y];u!=null&&u!==!1&&i.setAttribute(y,String(u))})})}let l=t.attrs[":text"],h=t.attrs[":html"];return l!==void 0?n.effect(()=>{i.textContent=String(x(l,r)??"")}):h!==void 0?n.effect(()=>{i.innerHTML=J(String(x(h,r)??""))}):i.appendChild(G(t.children,r,n)),i},qt=(t,e,n)=>{let s=document.createComment("if"),r=document.createDocumentFragment();r.appendChild(s);let o=null,i=null,c=null;return n.effect(()=>{let l=t.find(h=>h.expr===void 0||x(h.expr,e))??null;l!==i&&(c?.dispose(),o&&o.parentNode?.removeChild(o),o=null,i=l,l&&(c=A(e),o=z(l.node,e,c),s.parentNode.insertBefore(o,s.nextSibling)))}),r},H=(t,e,n)=>{Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0})},Ut=(t,e,n)=>{let s=t.attrs[":each"].match(Bt);if(!s)return document.createComment(`invalid :each expression "${t.attrs[":each"]}"`);let[,r,o]=s,i=t.attrs[":key"],{[":each"]:c,[":key"]:l,...h}=t.attrs,a={...t,attrs:h},p=document.createComment("each"),y=document.createDocumentFragment();y.appendChild(p);let u=[];return n.effect(()=>{let d=x(o,e),b=Array.isArray(d)?d:[],S=new Map(u.map(g=>[g.key,g])),f=b.map((g,R)=>{let $=Object.create(e);H($,r,g),H($,"$index",R);let C=i!==void 0?x(i,$):R,T=S.get(C);if(T&&Object.is(T.item,g))return H(T.scope,"$index",R),T;T?.fx.dispose(),T?.node.parentNode?.removeChild(T.node);let N=A(e);return{key:C,item:g,scope:$,fx:N,node:z(a,$,N)}}),m=new Set(f.map(g=>g.key));u.forEach(g=>{m.has(g.key)||(g.fx.dispose(),g.node.parentNode?.removeChild(g.node))});let E=p;f.forEach(g=>{E.nextSibling!==g.node&&p.parentNode.insertBefore(g.node,E.nextSibling),E=g.node}),u=f}),y},G=(t,e,n)=>{let s=document.createDocumentFragment(),r=0;for(;r<t.length;){let o=t[r];if(typeof o=="string"){let i=document.createTextNode("");n.effect(()=>{i.textContent=Ft(o,e)}),s.appendChild(i),r++;continue}if(":each"in o.attrs){s.appendChild(Ut(o,e,n)),r++;continue}if(":if"in o.attrs){let i=[{expr:o.attrs[":if"],node:o}];for(r++;r<t.length&&typeof t[r]!="string"&&":elseif"in t[r].attrs;){let c=t[r];i.push({expr:c.attrs[":elseif"],node:c}),r++}r<t.length&&typeof t[r]!="string"&&":else"in t[r].attrs&&(i.push({node:t[r]}),r++),s.appendChild(qt(i,e,n));continue}s.appendChild(z(o,e,n)),r++}return s},Ht=(t,e)=>G(t.template,e,A(e)),zt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Gt=/<([A-Za-z][\w-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)\/>/g,Kt=/(<script[\s\S]*?<\/script\s*>|<style[\s\S]*?<\/style\s*>)/gi,Vt=t=>t.split(Kt).map((e,n)=>n%2===1?e:e.replace(Gt,(s,r,o)=>zt.has(r.toLowerCase())?s:`<${r}${o}></${r}>`)).join(""),K="data-jq79",Zt=t=>{let e=2166136261;for(let n=0;n<t.length;n++)e=Math.imul(e^t.charCodeAt(n),16777619);return(e>>>0).toString(36)},gt=(t,e)=>{t.forEach(n=>{typeof n!="string"&&(n.attrs[K]=e,gt(n.children,e))})},Xt=(t,e)=>t.split(",").map(n=>{let s=n.trim(),r=s.indexOf("::"),o=r===-1?s:s.slice(0,r),i=r===-1?"":s.slice(r);return`${o}[${K}="${e}"]${i}`}).join(", "),yt=(t,e)=>{Array.from(t).forEach(n=>{n instanceof CSSStyleRule?n.selectorText=Xt(n.selectorText,e):n instanceof CSSGroupingRule&&yt(n.cssRules,e)})},Jt=(t,e)=>{/:deep\(|::v-deep|>>>/.test(t)&&console.warn("jq79: :deep()/::v-deep/>>> are not supported in <style scoped>; the rule will be dropped by the browser");let n=new CSSStyleSheet;return n.replaceSync(t),yt(n.cssRules,e),Array.from(n.cssRules).map(s=>s.cssText).join(`
|
|
6
|
+
`)},Yt=t=>{let n=new DOMParser().parseFromString(`<template>${Vt(t)}</template>`,"text/html").querySelector("template"),s=[],r=[],o=[];Array.from(n.content.children).forEach(c=>{let l={attrs:pt(c),content:c.textContent??""};c.tagName==="SCRIPT"?s.push(l):c.tagName==="STYLE"?r.push(l):o.push(ht(c))}),r.forEach(c=>{"lang"in c.attrs&&console.warn(`jq79: <style lang="${c.attrs.lang}"> needs the jq79/vite plugin to compile it. This component didn't go through the bundler, so its styles were left uncompiled and the browser will ignore them.`)});let i=c=>"scoped"in c.attrs&&!("lang"in c.attrs);if(r.some(i)){let c=Zt(t);gt(o,c),r.forEach(l=>{i(l)&&(l.scoped=Jt(l.content,c))})}return{template:o,scripts:s,styles:r}},V=t=>/\.html?([?#]|$)/.test(t)?L.fetch(t):import(t),Et=(t,e)=>t?`
|
|
7
|
+
//# sourceURL=${t}?jq79-script=${e}`:"",dt=t=>t.scoped??t.content,B=new Map,Qt=t=>{let e=B.get(t);if(!e){let n=document.createElement("style");n.textContent=t,document.head.appendChild(n),e={el:n,count:0},B.set(t,e)}e.count++},te=t=>{let e=B.get(t);e&&--e.count<=0&&(e.el.remove(),B.delete(t))},St={$:v,$$:M,$create:D,$reactive:O},ee=(t,e,n,s={},r=V,o={})=>{let i={...St,...s},c=new Proxy(e,{has:(h,a)=>a!=="$__effect"&&a!=="$__import"&&(Reflect.has(h,a)||!(a in globalThis)&&!(a in i))});new Function("$scope","$__effect","$__import",...Object.keys(i),`return (async () => { with ($scope) { ${t} } })()${Et(o.filename,o.index??0)}`)(c,n,r,...Object.values(i)).catch(h=>console.error("jq79: error in :setup script",h))},ne=t=>t&&t.default!==void 0?t.default:t,se=(t,e,n,s={},r=V,o={})=>{let i={...St,...s},c={},l=new Function("$__exports","$__default","$__import",...Object.keys(i),`return (async () => { "use strict";
|
|
6
8
|
${t}
|
|
7
|
-
;$__exports.done = true })()`)(
|
|
8
|
-
${S}`:S;Ht(w,r,s.effect,y,m);return}let{vars:x,code:E}=nt(u.content);x.forEach(w=>{w in r||(r[w]=void 0)});let L=":mounted"in u.attrs?`await $mounted();
|
|
9
|
-
${E}`:E;Wt(L,r,s.effect,y,m)});let g=document.createDocumentFragment();return g.append(this.startMarker,U(this.template,r,s),this.endMarker),this.content=g,n?this.styleEls=this.styles.map(u=>{let y=document.createElement("style");return y.textContent=u.content,y}):(this.styles.forEach(u=>Bt(u.content)),this.ownsSharedStyles=!0),this}mount(e,n){let r=typeof e=="string"?T(e):e;if(!r)throw new Error(`mount target not found: ${e}`);return(!this.content||n!==void 0)&&this.renderWith(n??{},this.useShadow),this.attach(r)}mountShadow(e,n){let r=typeof e=="string"?T(e):e;if(!r)throw new Error(`mount target not found: ${e}`);return(!this.content||n!==void 0||!this.useShadow)&&this.renderWith(n??{},!0),this.attach(r)}attach(e){this.mountRoot&&this.detach();let n=this.useShadow&&e instanceof Element?e.shadowRoot??e.attachShadow({mode:"open"}):e;return this.useShadow&&this.styleEls.forEach(r=>n.appendChild(r)),n.appendChild(this.content),this.mountRoot=n,this.resolveMounted?.(),this}detach(){if(!this.mountRoot||!this.content||!this.startMarker||!this.endMarker)return this;let e=this.startMarker;for(;e;){let n=e.nextSibling;if(this.content.appendChild(e),e===this.endMarker)break;e=n}return this.mountRoot=null,this}destroy(){return this.detach(),this.fx?.dispose(),this.fx=null,this.styleEls.forEach(e=>e.parentNode?.removeChild(e)),this.styleEls=[],this.ownsSharedStyles&&(this.styles.forEach(e=>It(e.content)),this.ownsSharedStyles=!1),this.content=null,this.startMarker=null,this.endMarker=null,this.data=null,this.resolveMounted=null,this}},qt=t=>new C(t);0&&(module.exports={$,$$,$create,$reactive,Component79,parseComponent,renderComponent});
|
|
9
|
+
;$__exports.done = true })()${Et(o.filename,o.index??0)}`)(c,ne,r,...Object.values(i)),h=y=>console.error("jq79: error in factory script",y),a=!1,p=()=>{if(a)return;a=!0;let y=c.default;if(typeof y!="function")return;let u=d=>{d&&typeof d=="object"&&Object.assign(e,d)};try{let d=y({$data:e,$effect:n,...s});d instanceof Promise?d.then(u).catch(h):u(d)}catch(d){h(d)}};l.then(p,h),c.done&&p()},L=class t{constructor(e,n={}){w(this,"template");w(this,"scripts");w(this,"styles");w(this,"modules");w(this,"filename");w(this,"data",null);w(this,"fx",null);w(this,"content",null);w(this,"startMarker",null);w(this,"endMarker",null);w(this,"styleEls",[]);w(this,"ownsSharedStyles",!1);w(this,"useShadow",!1);w(this,"mountRoot",null);w(this,"resolveMounted",null);w(this,"emitListeners",new Map);let s=typeof e=="string"?Yt(e):e;this.template=s.template,this.scripts=s.scripts,this.styles=s.styles,this.modules=n.modules??(typeof e=="string"?void 0:e.modules),this.filename=n.filename??(typeof e=="string"?void 0:e.filename)}static async fetch(e){let n=await fetch(e);if(!n.ok)throw new Error(`failed to fetch component from ${e}: ${n.status}`);return new t(await n.text(),{filename:e})}on(e,n){return this.emitListeners.has(e)||this.emitListeners.set(e,new Set),this.emitListeners.get(e).add(n),this}off(e,n){return this.emitListeners.get(e)?.delete(n),this}render(e={}){return this.renderWith(e,!1)}renderShadow(e={}){return this.renderWith(e,!0)}renderWith(e,n){this.destroy();let s=O({...e}),r=A(s);this.data=s,this.fx=r,this.useShadow=n,this.startMarker=document.createComment("jq79"),this.endMarker=document.createComment("/jq79");let o=this.startMarker,i=(f,m)=>{let E=new CustomEvent(f,{detail:m,bubbles:!0,composed:!0}),g=o.dispatchEvent(E);return o===this.startMarker&&this.emitListeners.get(f)?.forEach(R=>R(E,m)),g},c,l=new Promise(f=>{c=f});this.resolveMounted=c;let h=()=>l,a=this.endMarker,p=f=>{let m=[];for(let E=o.nextSibling;E&&E!==a;E=E.nextSibling)E instanceof Element&&(E.matches(f)&&m.push(E),m.push(...Array.from(E.querySelectorAll(f))));return m},y=f=>p(f)[0]??null,u=this.modules,d=f=>u&&f in u?Promise.resolve(u[f]):V(f),b=f=>`await $mounted();${f}`;this.scripts.forEach((f,m)=>{let E={$emit:i,$mounted:h,$self:y,$$self:p},g={filename:this.filename,index:m},R=at(f.content);if(R!==null){let N=":mounted"in f.attrs?b(R):R;se(N,s,r.effect,E,d,g);return}let{vars:$,code:C}=ct(f.content);$.forEach(N=>{N in s||(s[N]=void 0)});let T=":mounted"in f.attrs?b(C):C;ee(T,s,r.effect,E,d,g)});let S=document.createDocumentFragment();return S.append(this.startMarker,G(this.template,s,r),this.endMarker),this.content=S,n?this.styleEls=this.styles.map(f=>{let m=document.createElement("style");return m.textContent=f.content,m}):(this.styles.forEach(f=>Qt(dt(f))),this.ownsSharedStyles=!0),this}mount(e,n){let s=typeof e=="string"?v(e):e;if(!s)throw new Error(`mount target not found: ${e}`);return(!this.content||n!==void 0)&&this.renderWith(n??{},this.useShadow),this.attach(s)}mountShadow(e,n){let s=typeof e=="string"?v(e):e;if(!s)throw new Error(`mount target not found: ${e}`);return(!this.content||n!==void 0||!this.useShadow)&&this.renderWith(n??{},!0),this.attach(s)}attach(e){this.mountRoot&&this.detach();let n=this.useShadow&&e instanceof Element?e.shadowRoot??e.attachShadow({mode:"open"}):e;return this.useShadow&&this.styleEls.forEach(s=>n.appendChild(s)),n.appendChild(this.content),this.mountRoot=n,this.resolveMounted?.(),this}detach(){if(!this.mountRoot||!this.content||!this.startMarker||!this.endMarker)return this;let e=this.startMarker;for(;e;){let n=e.nextSibling;if(this.content.appendChild(e),e===this.endMarker)break;e=n}return this.mountRoot=null,this}destroy(){return this.detach(),this.fx?.dispose(),this.fx=null,this.styleEls.forEach(e=>e.parentNode?.removeChild(e)),this.styleEls=[],this.ownsSharedStyles&&(this.styles.forEach(e=>te(dt(e))),this.ownsSharedStyles=!1),this.content=null,this.startMarker=null,this.endMarker=null,this.data=null,this.resolveMounted=null,this}},re=t=>new L(t);0&&(module.exports={$,$$,$create,$reactive,Component79,parseComponent,renderComponent});
|
|
10
10
|
//# sourceMappingURL=jq79.cjs.map
|