Skip to content

Commit c4ae166

Browse files
jeff-zuckerclaude
andcommitted
sol-basic: curated app bundle (include/button/menu/login/form/settings)
New web/sol-basic.js aggregator + rollup target -> dist/sol-basic.bundle.min.js (IIFE, SolBasic). Registers the six everyday components plus the helpers they compose internally (accordion, default, modal, window, tree-edit, breadcrumb). dompurify/marked/n3/rdf-validate-shacl are bundled in; rdflib is the lone external ($rdf). solid-ui/solid-logic/auth stay runtime globals (BYO, in the order rdflib -> solid-logic -> solid-ui). Demos now run from sol-basic where appropriate: button + login use the IIFE bundle; form uses the ESM entry (window.UI must precede the auto-rendering form). menu-from-rdf stays on the full bundle (its demo launches sol-query, which isn't in sol-basic). All four verified rendering in-browser. install-modes.html documents the new bundle (light vs forms recipes). Tests: 1197 pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 8737459 commit c4ae166

8 files changed

Lines changed: 181 additions & 28 deletions

dist/sol-basic.bundle.min.js

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

help/install-modes.html

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ <h2>Two script tags (with login)</h2>
7474
7575
<nav class="page-nav" aria-label="Page sections">
7676
<a href="#one-tag">One script tag</a>
77+
<a href="#app-bundle">App bundle (sol-basic)</a>
7778
<a href="#per-component">Per-component (smaller)</a>
7879
<a href="#bundler">With a bundler</a>
7980
<a href="#importmap">ES modules + importmap</a>
@@ -90,7 +91,7 @@ <h2 id="one-tag">1. One script tag (simplest)</h2>
9091
&lt;sol-query endpoint="data.ttl" pattern="?s ?p ?o"&gt;&lt;/sol-query&gt;
9192
&lt;sol-menu&gt;...&lt;/sol-menu&gt;</code></pre>
9293
<div class="note-box">
93-
<strong>What's included:</strong> sol-menu, sol-include, sol-query, sol-login plus every dep they need at runtime. Auth (the inrupt OIDC client) is bring-your-own — drop in <code>dist/vendor/@inrupt-solid-client-authn-browser.umd.js</code> as a separate <code>&lt;script&gt;</code> tag <em>before</em> the bundle if you need login. Components requiring extra externals (sol-form needs solid-ui; sol-solidos needs mashlib) aren't in this bundle yet — use the importmap path for those.
94+
<strong>What's included:</strong> sol-menu, sol-include, sol-query, sol-login plus every dep they need at runtime. Auth (the inrupt OIDC client) is bring-your-own — drop in <code>dist/vendor/@inrupt-solid-client-authn-browser.umd.js</code> as a separate <code>&lt;script&gt;</code> tag <em>before</em> the bundle if you need login. Components requiring extra externals aren't in this bundle: <code>sol-form</code> / <code>sol-settings</code> need solid-ui + solid-logic — use the <a href="#app-bundle"><code>sol-basic</code> app bundle</a> for those; <code>sol-solidos</code> needs mashlib — use the importmap path.
9495
</div>
9596
9697
<h3>Auth fetch propagation</h3>
@@ -101,6 +102,73 @@ <h3>Auth fetch propagation</h3>
101102
&lt;sol-query login="#alt" endpoint="https://other.pod/data.ttl" ...&gt;&lt;/sol-query&gt;</code></pre>
102103
</div>
103104
105+
<h2 id="app-bundle">1b. App bundle — <code>sol-basic</code> (adds forms &amp; settings)</h2>
106+
<div class="api-block">
107+
<p>For building an actual app, not just dropping in one widget.
108+
<code>dist/sol-basic.bundle.min.js</code> is a curated set:
109+
<code>sol-include</code>, <code>sol-button</code>, <code>sol-menu</code>,
110+
<code>sol-login</code>, <code>sol-form</code>, and <code>sol-settings</code>
111+
— plus the helpers they compose internally (modal / floating surfaces, the
112+
menu editor, accordion, breadcrumb, shared defaults). Unlike the all-in-one
113+
bundle above, this one <strong>includes <code>sol-form</code> and
114+
<code>sol-settings</code></strong>, so you get editable, self-configuring
115+
components. Bundled in: <code>dompurify</code>, <code>marked</code>,
116+
<code>n3</code>, <code>rdf-validate-shacl</code>. Deliberately excluded:
117+
<code>sol-query</code>, <code>sol-feed</code>, <code>sol-pod*</code>,
118+
<code>sol-tabs</code>, the chrome widgets (weather / time / calendar) — load
119+
those separately if you need them.</p>
120+
<p><strong>Bring-your-own peers, in this order</strong> — a singleton
121+
handshake; get it wrong and you get two rdflib stores:</p>
122+
<pre><code>rdflib → solid-logic → solid-ui</code></pre>
123+
124+
<h3>Light subset (include / button / menu / login)</h3>
125+
<p>These never touch <code>window.UI</code>, so all you need is the rdflib
126+
UMD (plus the auth UMD for login):</p>
127+
<pre><code>&lt;script src="../dist/vendor/rdflib.umd.js"&gt;&lt;/script&gt;
128+
&lt;script src="../dist/vendor/@inrupt-solid-client-authn-browser.umd.js"&gt;&lt;/script&gt; &lt;!-- only for sol-login --&gt;
129+
&lt;script src="../dist/sol-basic.bundle.min.js"&gt;&lt;/script&gt;
130+
131+
&lt;sol-login&gt;&lt;/sol-login&gt;
132+
&lt;sol-menu from-rdf="data/menu.ttl#Main" region="#content"&gt;&lt;/sol-menu&gt;</code></pre>
133+
134+
<h3>Forms &amp; settings (sol-form / sol-settings)</h3>
135+
<p><code>solid-ui</code> and <code>solid-logic</code> ship only as ESM, so a
136+
page that edits data needs an importmap for those two plus a small bootstrap
137+
module. Load the bundle through its <strong>ES-module entry</strong>
138+
(<code>web/sol-basic.js</code>), not the IIFE file, so init order is
139+
guaranteed:</p>
140+
<pre><code>&lt;script src="../dist/vendor/rdflib.umd.js"&gt;&lt;/script&gt;
141+
&lt;script type="importmap"&gt;
142+
{ "imports": {
143+
"rdflib": "../dist/vendor/rdflib.js",
144+
"n3": "../dist/vendor/n3.js",
145+
"dompurify": "../dist/vendor/dompurify.js",
146+
"marked": "../dist/vendor/marked.js",
147+
"solid-ui": "../dist/vendor/solid-ui.js",
148+
"solid-logic": "../dist/vendor/solid-logic.js",
149+
"rdf-validate-shacl": "../dist/vendor/rdf-validate-shacl.js"
150+
} }
151+
&lt;/script&gt;
152+
&lt;script type="module"&gt;
153+
import * as solidLogic from 'solid-logic'; // solid-logic BEFORE solid-ui
154+
import 'solid-ui'; // sets window.UI
155+
import '../web/sol-basic.js'; // the ESM entry
156+
&lt;/script&gt;
157+
158+
&lt;sol-form shape="shapes/x.shacl" subject="data/x.ttl#It"&gt;&lt;/sol-form&gt;
159+
&lt;sol-settings&gt;&lt;/sol-settings&gt;</code></pre>
160+
<div class="note-box">
161+
<strong>Why two recipes?</strong> The IIFE bundle is a classic script that
162+
defines its elements during parse, so an auto-rendering
163+
<code>&lt;sol-form&gt;</code> would run before a deferred module could set
164+
<code>window.UI</code>. The ESM entry shares the module graph, so
165+
<code>solid-ui</code> is guaranteed to load first. The live demos on the
166+
<a href="sol-button-help.html">button</a> /
167+
<a href="sol-login-help.html">login</a> pages use the light recipe; the
168+
<a href="sol-form-help.html">form</a> page uses the module recipe.
169+
</div>
170+
</div>
171+
104172
<h2 id="per-component">2. Per-component bundle (smaller)</h2>
105173
<div class="api-block">
106174
<p>If you only need one or two components and care about size, load just those. Each component ships its own UMD bundle in <code>dist/</code>. You add one <code>&lt;script&gt;</code> tag per external it needs (loaded as plain UMD globals from a CDN like unpkg).</p>

help/sol-button-help.html

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,12 @@
88
<link rel="stylesheet" href="../web/styles/sol-query-help.css">
99
<link rel="stylesheet" href="../web/styles/help.css">
1010
<script src="../web/scripts/prefs.js"></script>
11-
<script type="importmap">
12-
{
13-
"imports": {
14-
"rdflib": "../dist/vendor/rdflib.js",
15-
"n3": "../dist/vendor/n3.js",
16-
"dompurify": "../dist/vendor/dompurify.js",
17-
"marked": "../dist/vendor/marked.js"
18-
}
19-
}
20-
</script>
21-
<script type="module">
22-
import '../web/sol-include.js';
23-
import '../web/sol-modal.js';
24-
import '../web/sol-window.js';
25-
import '../web/sol-button.js';
26-
</script>
11+
<!-- sol-basic bundle registers sol-button + its display surfaces
12+
(sol-include / sol-modal / sol-window are bundled in). rdflib UMD
13+
first: the bundle reads window.$rdf. No window.UI needed here —
14+
buttons don't render forms. -->
15+
<script src="../dist/vendor/rdflib.umd.js"></script>
16+
<script src="../dist/sol-basic.bundle.min.js"></script>
2717
</head>
2818
<body class="scroll-help">
2919

help/sol-form-help.html

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,28 @@
1818
"imports": {
1919
"rdflib": "../dist/vendor/rdflib.js",
2020
"n3": "../dist/vendor/n3.js",
21+
"dompurify": "../dist/vendor/dompurify.js",
22+
"marked": "../dist/vendor/marked.js",
2123
"solid-ui": "../dist/vendor/solid-ui.js",
2224
"solid-logic": "../dist/vendor/solid-logic.js",
2325
"rdf-validate-shacl": "../dist/vendor/rdf-validate-shacl.js"
2426
}
2527
}
2628
</script>
2729
<script type="module">
28-
// Side-effect imports needed by <sol-form>:
29-
// solid-ui sets window.UI on first eval (fieldFunction lives here).
30-
// solid-logic is exposed on window.solidLogic so swc's core/rdf.js
31-
// rendezvous on the same store.
32-
// Then register <sol-form> by importing its module for its
33-
// customElements.define side effect.
34-
import 'solid-ui';
30+
// BYO peers in the singleton-handshake order rdflib → solid-logic →
31+
// solid-ui: solid-logic self-registers its singleton store
32+
// (Symbol.for('solid-logic-singleton')) that swc's core/rdf.js adopts;
33+
// solid-ui then sets window.UI (fieldFunction) that sol-form renders
34+
// through. (rdflib is pulled in transitively by both, via the importmap.)
3535
import * as solidLogic from 'solid-logic';
36+
import 'solid-ui';
3637
if (typeof window !== 'undefined') window.solidLogic = solidLogic;
37-
import '../web/sol-form.js';
38-
import '../web/sol-include.js';
38+
// Register the curated component set via the sol-basic ESM ENTRY — not the
39+
// IIFE bundle. The bundle is a classic script that would define sol-form
40+
// before this deferred module sets window.UI, racing the auto-rendering
41+
// demo; the ESM entry shares this module graph so init order holds.
42+
import '../web/sol-basic.js';
3943
</script>
4044

4145
</head>

help/sol-login-help.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@
88
<link rel="stylesheet" href="../web/styles/sol-query-help.css">
99
<link rel="stylesheet" href="../web/styles/help.css">
1010
<script src="../web/scripts/prefs.js"></script>
11+
<!-- sol-basic bundle registers sol-login. rdflib UMD ($rdf) + the inrupt
12+
auth UMD (window.solidClientAuthn) are sol-login's BYO peers; load
13+
both before the bundle. -->
1114
<script src="../dist/vendor/rdflib.umd.js"></script>
1215
<script src="../dist/vendor/@inrupt-solid-client-authn-browser.umd.js"></script>
13-
<script src="../dist/solid-web-components.bundle.min.js"></script>
16+
<script src="../dist/sol-basic.bundle.min.js"></script>
1417
<style>
1518
body { padding-top: 8px; }
1619
b { color: orange; }

help/sol-menu-from-rdf.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,10 @@ <h2>Menus from RDF definition files</h2>
114114
-->
115115

116116
<!--
117-
Solid-web-components (required)
117+
Solid-web-components (required) : this demo's menu launches a sol-query
118+
item, which is NOT in sol-basic — so it uses the broader self-contained
119+
bundle. For a menu that only launches sol-basic components, sol-basic
120+
(+ rdflib UMD) is enough; see sol-button / sol-form help.
118121
-->
119122
<script src="../dist/solid-web-components.bundle.min.js"></script>
120123
<!-- ---------------------------------------------------------------- -->

rollup.config.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,27 @@ export default [
256256
inlineDynamicImports: true,
257257
},
258258
},
259+
// ── sol-basic (curated subset: include/button/menu/login/form/settings +
260+
// the helpers those six instantiate by tag: accordion/modal/window/
261+
// tree-edit). dompurify/marked/n3/rdf-validate-shacl are bundled IN;
262+
// rdflib stays the lone BYO peer ($rdf global). solid-ui/solid-logic/
263+
// auth are runtime globals the components probe — never imported, so
264+
// there is nothing to externalize for them. ─────────────────────────────
265+
{
266+
input: 'web/sol-basic.js',
267+
external: (id) => id === 'rdflib' || id.startsWith('https://esm.sh/'),
268+
plugins: bundlePlugins,
269+
output: {
270+
file: minify
271+
? 'dist/sol-basic.bundle.min.js'
272+
: 'dist/sol-basic.bundle.js',
273+
format: 'iife',
274+
name: 'SolBasic',
275+
exports: 'named',
276+
inlineDynamicImports: true,
277+
globals: { rdflib: '$rdf' },
278+
},
279+
},
259280
// ── all-in-one bundle: every component, rdflib externalized as $rdf ─────────
260281
// rdflib is treated as a runtime peer (BYO), shipped as
261282
// `dist/vendor/rdflib.umd.js` which self-publishes `window.$rdf`. Page

web/sol-basic.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/**
2+
* sol-basic.js — curated bundle entry: the everyday-app subset.
3+
*
4+
* Registers exactly six author-facing components:
5+
* sol-include, sol-button, sol-menu, sol-login, sol-form, sol-settings
6+
* …plus the helpers those six conjure / instantiate by tag name at runtime.
7+
* These helpers are COMPOSED INTERNALLY — not meant to be author-placed —
8+
* but they're global custom elements all the same, so they must be
9+
* registered for the six to run at full capacity:
10+
* sol-accordion — settings panel chrome (static dep of sol-settings)
11+
* sol-default — singleton holding shared non-CSS defaults (proxy, …)
12+
* sol-modal — the "modal" display surface + the editor-self gear popup
13+
* sol-window — the "floating" display surface
14+
* sol-tree-edit — sol-menu's editor (settings/gear mount it via core/editor)
15+
* sol-breadcrumb — sol-tree-edit's drill-in/out navigation crumb
16+
* The author-facing surface for the conjured ones is the region KEYWORD
17+
* (region="modal" / "floating"), not the tag — see core/display-target.js.
18+
* Nothing else is pulled in.
19+
*
20+
* Everything these components need is bundled IN (dompurify, marked, n3,
21+
* rdf-validate-shacl are inlined). Bring-your-own runtime peers, loaded
22+
* BEFORE this bundle, IN THIS ORDER (rdflib → solid-logic → solid-ui — a
23+
* singleton handshake; see project memory):
24+
* - rdflib → `window.$rdf` (vendored UMD script tag)
25+
* - solid-logic → singleton rdflib store (ESM, importmap)
26+
* - solid-ui → `window.UI` widgets (ESM, importmap)
27+
* - @inrupt/solid-client-authn-browser → `window.solidClientAuthn`
28+
* (only sol-login; vendored UMD script tag)
29+
*
30+
* NOTE: solid-ui/solid-logic ship only as ESM, so a page that uses sol-form
31+
* or sol-settings needs an importmap for those two plus a tiny bootstrap
32+
* module that imports them (side-effects window.UI + the store). The
33+
* include/button/menu/login subset, which never touches window.UI, can run
34+
* from just the rdflib (+auth) UMD script tags and this bundle.
35+
*/
36+
37+
import './sol-include.js';
38+
import './sol-button.js';
39+
import './sol-menu.js';
40+
import './sol-login.js';
41+
import './sol-form.js';
42+
import './sol-settings.js'; // statically pulls in sol-accordion
43+
44+
// Registered-by-tag helpers the six conjure / instantiate at runtime:
45+
import './sol-default.js'; // singleton holding shared non-CSS defaults (proxy, region…)
46+
import './sol-modal.js'; // modal display surface + editor-self gear popup
47+
import './sol-window.js'; // floating-window display surface
48+
import './sol-tree-edit.js'; // sol-menu's editor
49+
import './sol-breadcrumb.js'; // sol-tree-edit's drill-in/out navigation crumb
50+
51+
// Surface the JS API on `window.SolBasic.*` for hosts that need the class
52+
// symbols, not just the registered custom-element tags.
53+
export { AuthManager } from './sol-login.js';
54+
export { solFetch } from '../core/auth-fetch.js';

0 commit comments

Comments
 (0)