Skip to content

Commit c6fc7fe

Browse files
committed
removed rdf and solid logic exports from solid-ui
1 parent 0ca1899 commit c6fc7fe

22 files changed

+259
-286
lines changed

.storybook/main.js

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ export default {
1616
autodocs: true
1717
},
1818
webpackFinal: async (config) => {
19-
// For Storybook, we want to bundle rdflib and solid-logic from devDependencies
20-
// instead of externalizing them, so we DON'T add them to externals
19+
// For Storybook, we DON'T externalize rdflib and solid-logic
20+
// Instead, we let webpack bundle them from node_modules
2121

2222
// Handle Node.js modules for browser
2323
config.resolve.fallback = {
@@ -30,32 +30,10 @@ export default {
3030
buffer: false
3131
}
3232

33-
// Add module name mapping to resolve the external references
33+
// Alias $rdf to rdflib for solid-logic compatibility
3434
config.resolve.alias = {
3535
...config.resolve.alias,
36-
$rdf: require.resolve('rdflib'),
37-
SolidLogic: require.resolve('solid-logic')
38-
}
39-
40-
// Ensure solid-logic is not treated as external for Storybook
41-
if (config.externals) {
42-
if (Array.isArray(config.externals)) {
43-
config.externals = config.externals.filter(external => {
44-
if (typeof external === 'string') return !['rdflib', 'solid-logic', '$rdf', 'SolidLogic'].includes(external)
45-
if (typeof external === 'object') {
46-
delete external['rdflib']
47-
delete external['solid-logic']
48-
delete external['$rdf']
49-
delete external['SolidLogic']
50-
}
51-
return true
52-
})
53-
} else if (typeof config.externals === 'object') {
54-
delete config.externals['rdflib']
55-
delete config.externals['solid-logic']
56-
delete config.externals['$rdf']
57-
delete config.externals['SolidLogic']
58-
}
36+
$rdf: 'rdflib'
5937
}
6038

6139
return config

.storybook/preview.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
// For backward compatibility, provide rdflib and solid-logic as globals
2+
import * as rdflib from 'rdflib'
3+
import * as solidLogic from 'solid-logic'
4+
5+
// Some legacy code might expect these as globals
6+
if (typeof window !== 'undefined') {
7+
window.$rdf = rdflib
8+
window.SolidLogic = solidLogic
9+
}
10+
111
export const parameters = {
212
actions: { argTypesRegex: '^on[A-Z].*' },
313
}

docs/form-examples/test-form.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11

2-
/* global $rdf UI debug */
3-
if (!window) {
4-
window.alert('Missing UI code - load mashlib first.')
5-
}
6-
window.$rdf = window.UI.rdf
72

83
document.addEventListener('DOMContentLoaded', async function () {
94
/// ///////////////////////////////////////////
105

11-
var kb = UI.store
6+
var kb = SolidLogic.store
127

138
kb.updater.editable = // uri => true // Force modifyable UX // @@@
149
function (uri) {

examples/header/index.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<head>
55
<meta charset='UTF-8'>
66
<title>solid-ui UI.widgets.header examples page</title>
7+
<script src="https://unpkg.com/solid-logic/dist/solid-logic.min.js"></script>
78
<script src="../../dist/solid-ui.js"></script>
89
<script>
910
const $ = document.querySelector.bind(document)
@@ -27,8 +28,8 @@ <h2 id="header"><a href="#header">Header</a>
2728
loginBanner.appendChild(UI.login.loginStatusBox(document, null, {}));
2829

2930
async function finishLogin() {
30-
await UI.authn.authSession.handleIncomingRedirect();
31-
const session = UI.authn.authSession;
31+
await SolidLogic.authn.authSession.handleIncomingRedirect();
32+
const session = SolidLogic.authn.authSession;
3233
if (session.info.isLoggedIn) {
3334
// Update the page with the status.
3435
webId.innerHTML = "Logged in as: " + session.currentUser().uri;
@@ -81,7 +82,7 @@ <h2 id="header"><a href="#header">Header</a>
8182
window.addEventListener('DOMContentLoaded', async () => {
8283
try {
8384
options = { menuList: [{ label: "Testing Button", onclick: () => { alert('hello') } }, { label: "Testing Link", url: 'https://reflectechblog.wordpress.com/' }] }
84-
await UI.initHeader(UI.store, options)
85+
await UI.initHeader(SolidLogic.store, options)
8586
} catch (error) {
8687
window.alert(`Error loading header. You need to have a div with id = PageHeader on your page.`)
8788
}

examples/matrix/test-matrix.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
if (!window.UI) {
2-
window.alert('Please run "npm install && npm run build" in your repo root first.')
3-
}
4-
window.$rdf = UI.rdf
5-
61
document.addEventListener('DOMContentLoaded', function () {
72
/// ///////////////////////////////////////////
83

9-
const kb = UI.store
4+
const kb = SolidLogic.store
105
const dom = document
116

127
const ICAL = $rdf.Namespace('http://www.w3.org/2002/12/cal/ical#')

src/chat/bookmarks.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@ import { icons } from '../iconBase'
88
import { media } from '../media/index'
99
import ns from '../ns'
1010
import * as pad from '../pad'
11-
import * as rdf from 'rdflib' // pull in first avoid cross-refs
11+
import * as $rdf from 'rdflib' // pull in first avoid cross-refs
1212
import { style } from '../style'
1313
import * as utils from '../utils'
1414
import * as widgets from '../widgets'
1515
import { store, createTypeIndexLogic, authn } from 'solid-logic'
1616
import { findAppInstances } from '../login/login'
1717

18-
const UI = { icons, ns, media, pad, rdf, style, utils, widgets }
19-
const $rdf = UI.rdf
18+
const UI = { icons, ns, media, pad, style, utils, widgets }
2019

2120
const BOOK = $rdf.Namespace('http://www.w3.org/2002/01/bookmark#')
2221
const BOOKMARK_ICON = 'noun_45961.svg'

src/stories/Buttons.stories.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ import { action } from '@storybook/addon-actions'
8787
document.outlineManager = {
8888
GotoSubject: action('go to subject')
8989
}
90-
return UI.widgets.linkButton(document, UI.rdf.namedNode('http://example.com/'))
90+
return UI.widgets.linkButton(document, $rdf.namedNode('http://example.com/'))
9191
}
9292
}
9393
</Story>
@@ -100,15 +100,15 @@ import { action } from '@storybook/addon-actions'
100100
{
101101
UI.widgets.linkIcon(
102102
document,
103-
UI.rdf.namedNode('https://solidproject.org/')
103+
$rdf.namedNode('https://solidproject.org/')
104104
)
105105
}
106106
</Story>
107107
<Story name="Link custom icon">
108108
{
109109
UI.widgets.linkIcon(
110110
document,
111-
UI.rdf.namedNode('https://solidproject.org/'),
111+
$rdf.namedNode('https://solidproject.org/'),
112112
'https://solidproject.org/favicon.ico'
113113
)
114114
}

src/stories/Display.stories.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ Sets the best name we have and looks up a better one
4040
<Story name="setName">
4141
{() => {
4242
const div = document.createElement("div");
43-
const jane = UI.rdf.namedNode("https://jane.example/person/card#me");
44-
UI.store.add(jane, UI.ns.foaf("name"), "Jane Doe");
43+
const jane = $rdf.namedNode("https://jane.example/person/card#me");
44+
SolidLogic.store.add(jane, UI.ns.foaf("name"), "Jane Doe");
4545
UI.widgets.setName(div, jane);
4646
return div;
4747
}}

src/stories/DragAndDrop.stories.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Drag the message from the "Draggable" story or drag any file or image and drop i
2525
{() => {
2626
const dragElement = document.createElement("div")
2727
dragElement.appendChild(document.createTextNode("Drag me to the target!"))
28-
const uri = new UI.rdf.NamedNode('https://exampleuser.inrupt.net')
28+
const uri = new $rdf.NamedNode('https://exampleuser.inrupt.net')
2929
UI.widgets.makeDraggable(dragElement, uri)
3030
return dragElement
3131
}}
@@ -56,7 +56,7 @@ The function `uploadFiles` could for example be used in the droppedFileHandler f
5656
target.style = "padding: 1em; text-align:center; border: 1px solid black; width: 100px; height: 100px"
5757
target.appendChild(document.createTextNode("Drop a file (document, picture, ...) here"))
5858
UI.widgets.makeDropTarget(target, action('dropped uri'), (files) => {
59-
UI.widgets.uploadFiles(UI.store.fetcher, files, fileBase, pictureBase, action('file uploaded successfully'))
59+
UI.widgets.uploadFiles(SolidLogic.store.fetcher, files, fileBase, pictureBase, action('file uploaded successfully'))
6060
})
6161
return target
6262
}}

src/stories/Header.stories.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ To experience the full behaviour of the header, you need to log in. This can be
2020
<Story name="header" decorators={[headerDecorator]}>
2121
{() => {
2222
const options = {};
23-
UI.initHeader(UI.store, options);
23+
UI.initHeader(SolidLogic.store, options);
2424
}}
2525
</Story>
2626
</Canvas>

0 commit comments

Comments
 (0)