Skip to content

Commit

Permalink
chore: removed legacy transforms (#817)
Browse files Browse the repository at this point in the history
  • Loading branch information
snyamathi committed Nov 6, 2023
1 parent c5a7014 commit 1fc8c36
Show file tree
Hide file tree
Showing 99 changed files with 512 additions and 489 deletions.
1 change: 1 addition & 0 deletions .npmrc
@@ -1 +1,2 @@
legacy-peer-deps = true
package-lock = false
2 changes: 1 addition & 1 deletion examples/chat/app.js
Expand Up @@ -14,7 +14,7 @@ var app = new Fluxible({
app.plug(
fetchrPlugin({
xhrPath: '/api',
})
}),
);

app.registerStore(require('./stores/RouteStore'));
Expand Down
2 changes: 1 addition & 1 deletion examples/chat/client.js
Expand Up @@ -40,7 +40,7 @@ app.rehydrate(dehydratedState, function (err, context) {
},
function (err) {
throw err;
}
},
);
}, 1000);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/chat/components/MessageSection.js
Expand Up @@ -60,5 +60,5 @@ module.exports = connectToStores(
(context) => ({
messages: context.getStore(MessageStore).getAllForCurrentThread(),
thread: context.getStore(ThreadStore).getCurrent(),
})
}),
);
2 changes: 1 addition & 1 deletion examples/chat/components/ThreadSection.js
Expand Up @@ -47,5 +47,5 @@ module.exports = connectToStores(
currentThreadID: context.getStore(ThreadStore).getCurrentID(),
threads: context.getStore(ThreadStore).getAllChrono(),
unreadCount: context.getStore(UnreadThreadStore).getCount(),
})
}),
);
4 changes: 2 additions & 2 deletions examples/chat/configs/routes.js
Expand Up @@ -23,9 +23,9 @@ module.exports = {
{ threadID: threadID },
function () {
done();
}
},
);
}
},
);
},
},
Expand Down
4 changes: 2 additions & 2 deletions examples/chat/server.js
Expand Up @@ -46,7 +46,7 @@ function renderPage(req, res, context) {
React.createElement(HtmlComponent, {
state: exposed,
markup: mainMarkup,
})
}),
);

debug('Sending markup');
Expand Down Expand Up @@ -78,7 +78,7 @@ server.use(function (req, res, next) {
return;
}
renderPage(req, res, context);
}
},
);
}
});
Expand Down
2 changes: 1 addition & 1 deletion examples/create-react-app/src/RandomNumberGenerator.js
Expand Up @@ -18,5 +18,5 @@ export default connectToStores(
(context) => ({
number: context.getStore(AppStore).getNumber(),
setRandomNumber: () => context.executeAction(actions.setRandomNumber),
})
}),
);
2 changes: 1 addition & 1 deletion examples/fluxible-router/browser-only/browser-only.js
Expand Up @@ -35,6 +35,6 @@ app.rehydrate(dehydratedState, (err, context) => {
window.context = context;
bootstrapDebug('React Rendering');
render(createElementWithContext(context, {}), mountNode);
}
},
);
});
4 changes: 2 additions & 2 deletions examples/fluxible-router/components/Application.js
Expand Up @@ -32,6 +32,6 @@ export default provideContext(
connectToStores(Application, [ApplicationStore], (context) => ({
...context.getStore(ApplicationStore).getState(),
})),
{ enableScroll: false }
)
{ enableScroll: false },
),
);
2 changes: 1 addition & 1 deletion examples/fluxible-router/components/Page.js
Expand Up @@ -9,5 +9,5 @@ import { connectToStores } from 'fluxible-addons-react';
const Page = ({ content }) => <p>{content}</p>;

export default connectToStores(Page, [PageStore], (context) =>
context.getStore(PageStore).getState()
context.getStore(PageStore).getState(),
);
4 changes: 2 additions & 2 deletions examples/fluxible-router/server.js
Expand Up @@ -37,7 +37,7 @@ server.use((req, res, next) => {
const state = 'window.App=' + serialize(app.dehydrate(context)) + ';';

const markup = ReactDOM.renderToString(
createElementWithContext(context)
createElementWithContext(context),
);
const helmet = Helmet.renderStatic();

Expand All @@ -48,7 +48,7 @@ server.use((req, res, next) => {
markup,
helmet,
context: context.getComponentContext(),
})
}),
);

debug('Sending markup');
Expand Down
2 changes: 1 addition & 1 deletion examples/minimal/src/RandomNumberGenerator.js
Expand Up @@ -18,5 +18,5 @@ export default connectToStores(
(context) => ({
number: context.getStore(AppStore).getNumber(),
setRandomNumber: () => context.executeAction(actions.setRandomNumber),
})
}),
);
4 changes: 2 additions & 2 deletions examples/react-router/client.js
Expand Up @@ -25,12 +25,12 @@ function RenderApp(context) {
React.createElement(ReactRouter.Router, {
routes: context.getComponent(),
history: ReactRouter.browserHistory,
})
}),
),
mountNode,
function () {
bootstrapDebug('React Rendered');
}
},
);
}

Expand Down
2 changes: 1 addition & 1 deletion examples/react-router/components/Page.js
Expand Up @@ -20,7 +20,7 @@ class Page extends React.Component {
}

Page = connectToStores(Page, [PageStore], (context) =>
context.getStore(PageStore).getState()
context.getStore(PageStore).getState(),
);

export default Page;
10 changes: 5 additions & 5 deletions examples/react-router/server.js
Expand Up @@ -34,7 +34,7 @@ server.use(function (req, res, next) {
} else if (redirectLocation) {
res.redirect(
302,
redirectLocation.pathname + redirectLocation.search
redirectLocation.pathname + redirectLocation.search,
);
} else if (renderProps) {
var context = app.createContext();
Expand All @@ -50,24 +50,24 @@ server.use(function (req, res, next) {
var markupElement = React.createElement(
FluxibleComponent,
{ context: context.getComponentContext() },
React.createElement(RouterContext, renderProps)
React.createElement(RouterContext, renderProps),
);
var html = renderToStaticMarkup(
<HtmlComponent
context={context.getComponentContext()}
state={exposed}
markup={renderToString(markupElement)}
/>
/>,
);

debug('Sending markup');
res.status(200).send(html);
}
},
);
} else {
next();
}
}
},
);
});

Expand Down
2 changes: 1 addition & 1 deletion examples/stale-props/src/Item.js
Expand Up @@ -29,5 +29,5 @@ export default connectToStores(
({ getStore, executeAction }, { itemId }) => ({
item: getStore(ListStore).getItem(itemId),
remove: () => executeAction(removeItem, { itemId }),
})
}),
);
2 changes: 1 addition & 1 deletion examples/stale-props/src/index.js
Expand Up @@ -12,5 +12,5 @@ ReactDOM.render(
<App />
</FluxibleProvider>
</React.StrictMode>,
document.getElementById('root')
document.getElementById('root'),
);
2 changes: 1 addition & 1 deletion examples/todo/actions/toggleAll.js
Expand Up @@ -20,6 +20,6 @@ module.exports = function (context, payload, done) {

context.dispatch('TOGGLE_ALL_TODO_SUCCESS', todos);
done();
}
},
);
};
2 changes: 1 addition & 1 deletion examples/todo/app.js
Expand Up @@ -14,7 +14,7 @@ var app = new Fluxible({
app.plug(
fetchrPlugin({
xhrPath: '/api',
})
}),
);

app.registerStore(require('./stores/TodoStore'));
Expand Down
19 changes: 14 additions & 5 deletions examples/todo/assets/todomvc-common/base.css
Expand Up @@ -20,7 +20,11 @@ button {
}

body {
font: 14px 'Helvetica Neue', Helvetica, Arial, sans-serif;
font:
14px 'Helvetica Neue',
Helvetica,
Arial,
sans-serif;
line-height: 1.4em;
background: #eaeaea url('bg.png');
color: #4d4d4d;
Expand All @@ -46,7 +50,8 @@ input[type='checkbox'] {
position: relative;
border-top-left-radius: 2px;
border-top-right-radius: 2px;
box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.2),
box-shadow:
0 2px 6px 0 rgba(0, 0, 0, 0.2),
0 25px 50px 0 rgba(0, 0, 0, 0.15);
}

Expand Down Expand Up @@ -285,7 +290,9 @@ label[for='toggle-all'] {
}

#todo-list li .destroy:hover {
text-shadow: 0 0 1px #000, 0 0 10px rgba(199, 107, 107, 0.8);
text-shadow:
0 0 1px #000,
0 0 10px rgba(199, 107, 107, 0.8);
-webkit-transform: scale(1.3);
transform: scale(1.3);
}
Expand Down Expand Up @@ -326,8 +333,10 @@ label[for='toggle-all'] {
left: 0;
height: 50px;
z-index: -1;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3),
0 6px 0 -3px rgba(255, 255, 255, 0.8), 0 7px 1px -3px rgba(0, 0, 0, 0.3),
box-shadow:
0 1px 1px rgba(0, 0, 0, 0.3),
0 6px 0 -3px rgba(255, 255, 255, 0.8),
0 7px 1px -3px rgba(0, 0, 0, 0.3),
0 43px 0 -6px rgba(255, 255, 255, 0.8),
0 44px 2px -6px rgba(0, 0, 0, 0.2);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/todo/components/TodoApp.js
Expand Up @@ -190,5 +190,5 @@ module.exports = provideContext(
connectToStores(TodoApp, [TodoStore], (context) => ({
items: context.getStore(TodoStore).getAll(),
context,
}))
})),
);
2 changes: 1 addition & 1 deletion examples/todo/components/TodoItem.js
Expand Up @@ -39,7 +39,7 @@ class Component extends React.Component {
const node = this.editField.current;
node.focus();
node.setSelectionRange(node.value.length, node.value.length);
}.bind(this)
}.bind(this),
);

this.setState({ editText: this.props.todo.text });
Expand Down
4 changes: 2 additions & 2 deletions examples/todo/server.js
Expand Up @@ -57,10 +57,10 @@ server.use(function (req, res, next) {
HtmlComponent({
state: exposed,
markup: ReactDOM.renderToString(
createElementWithContext(context)
createElementWithContext(context),
),
context: componentContext,
})
}),
);

res.send(html);
Expand Down
54 changes: 36 additions & 18 deletions examples/todo/services/todo.js
Expand Up @@ -12,9 +12,12 @@ var randomResponseTime = function (min, max) {
module.exports = {
name: 'todo',
read: function (req, resource, params, config, callback) {
setTimeout(function () {
callback(null, _todos.concat());
}, randomResponseTime(100, 1000));
setTimeout(
function () {
callback(null, _todos.concat());
},
randomResponseTime(100, 1000),
);
},
create: function (req, resource, params, body, config, callback) {
var newTodo = {
Expand All @@ -24,16 +27,22 @@ module.exports = {

if (params.text.indexOf('fail') > -1) {
var err = new Error('Shenanigans');
setTimeout(function () {
callback(err);
}, randomResponseTime(800, 1000));
setTimeout(
function () {
callback(err);
},
randomResponseTime(800, 1000),
);
return;
} else {
_todos.push(newTodo);

setTimeout(function () {
callback(null, newTodo);
}, randomResponseTime(100, 1000));
setTimeout(
function () {
callback(null, newTodo);
},
randomResponseTime(100, 1000),
);
}
},
update: function (req, resource, params, body, config, callback) {
Expand All @@ -42,9 +51,12 @@ module.exports = {
todo.completed = params.checked;
});

setTimeout(function () {
callback(null, _todos);
}, randomResponseTime(100, 1000));
setTimeout(
function () {
callback(null, _todos);
},
randomResponseTime(100, 1000),
);
} else {
var foundTodo;

Expand All @@ -57,18 +69,24 @@ module.exports = {
}
});

setTimeout(function () {
callback(null, foundTodo);
}, randomResponseTime(100, 1000));
setTimeout(
function () {
callback(null, foundTodo);
},
randomResponseTime(100, 1000),
);
}
},
delete: function (req, resource, params, config, callback) {
_todos = _todos.filter(function (todo, index) {
return params.ids.indexOf(todo.id) === -1;
});

setTimeout(function () {
callback(null, _todos);
}, randomResponseTime(100, 1000));
setTimeout(
function () {
callback(null, _todos);
},
randomResponseTime(100, 1000),
);
},
};
2 changes: 1 addition & 1 deletion packages/dispatchr/addons/BaseStore.js
Expand Up @@ -49,7 +49,7 @@ BaseStore.prototype.addChangeListener = function addChangeListener(callback) {
* @param {Function} callback
*/
BaseStore.prototype.removeChangeListener = function removeChangeListener(
callback
callback,
) {
this.removeListener(CHANGE_EVENT, callback);
};
Expand Down
2 changes: 1 addition & 1 deletion packages/dispatchr/addons/createStore.js
Expand Up @@ -29,7 +29,7 @@ function mixInto(dest, src) {
} else {
if (dest.hasOwnProperty(prop)) {
throw new Error(
'Mixin property collision for property "' + prop + '"'
'Mixin property collision for property "' + prop + '"',
);
}
dest[prop] = src[prop];
Expand Down

0 comments on commit 1fc8c36

Please sign in to comment.