@rip-lang/ui 0.3.9 → 0.3.11

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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rip-lang/ui",
3
- "version": "0.3.9",
3
+ "version": "0.3.11",
4
4
  "description": "Zero-build reactive web framework — rip.js + ui.rip + launch(url)",
5
5
  "type": "module",
6
6
  "main": "ui.rip",
package/ui.rip CHANGED
@@ -834,9 +834,24 @@ export launch = (appBase = '', opts = {}) ->
834
834
  el.id = target.replace(/^#/, '')
835
835
  document.body.prepend el
836
836
 
837
- # Get the app bundle — inline, from DOM, or fetch from server
837
+ # Get the app bundle — explicit, static files, inline DOM, or server fetch
838
838
  if opts.bundle
839
839
  bundle = opts.bundle
840
+ else if opts.components and Array.isArray(opts.components)
841
+ components = {}
842
+ for url in opts.components
843
+ res = await fetch(url)
844
+ if res.ok
845
+ name = url.split('/').pop()
846
+ components["components/#{name}"] = await res.text()
847
+ bundle = { components, data: {} }
848
+ else if typeof document isnt 'undefined' and document.querySelectorAll('script[type="text/rip"][data-name]').length > 0
849
+ components = {}
850
+ for script in document.querySelectorAll('script[type="text/rip"][data-name]')
851
+ name = script.getAttribute('data-name')
852
+ name += '.rip' unless name.endsWith('.rip')
853
+ components["components/#{name}"] = script.textContent
854
+ bundle = { components, data: {} }
840
855
  else
841
856
  bundleUrl = "#{appBase}/bundle"
842
857
  res = await fetch(bundleUrl)