@thoughtbot/superglue 0.54.0 → 1.0.0

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.
@@ -1,65 +1,64 @@
1
+ import * as history from 'history';
2
+ import { J as JSONMappable, K as Keypath, a as JSONValue, P as PageKey, N as NavigationContextProps, b as NavigationProviderProps, c as NavigateTo, V as VisitResponse, F as FetchArgs, S as SuperglueState, d as SuperglueStore, e as SetupProps, A as ApplicationVisit, f as ApplicationRemote, H as Handlers, g as ApplicationProps } from './index-BYr1PoYr.mjs';
3
+ export { t as AllPages, O as BasicRequestInit, _ as BeforeSave, Q as BuildStore, T as BuildVisitAndRemote, C as ComponentIdentifier, D as Defer, L as DefermentThunk, y as Dispatch, q as Fragment, G as GraftResponse, a0 as GraftingErrorAction, $ as GraftingSuccessAction, z as HistoryState, l as JSONKeyable, k as JSONObject, j as JSONPrimitive, M as Meta, E as MetaThunk, i as NavigationAction, n as Page, o as PageResponse, m as ParsedResponse, Y as Remote, x as RemoteCreator, Z as RemoteProps, R as RestoreStrategy, u as RootState, B as SaveAndProcessPageThunk, U as UJSHandlers, W as Visit, w as VisitCreator, v as VisitMeta, I as VisitMetaThunk, X as VisitProps, p as pageReducer, r as rootReducer, s as saveAndProcessPage, h as superglueReducer } from './index-BYr1PoYr.mjs';
1
4
  import React from 'react';
2
- import { A as AllPages, P as PageReducerAction, S as SuperglueState, a as SuperglueReducerAction, J as JSONMappable, K as Keypath, b as JSONValue, c as PageKey, R as RootState, D as Dispatch, N as Nav, d as SuperglueStore, V as Visit, e as Remote, f as VisitResponse } from './index-DfWsUSqv.mjs';
3
- import { UnknownAction, Middleware } from 'redux';
4
- import { BrowserHistory } from 'history';
5
- import '@reduxjs/toolkit';
6
- import 'react-redux';
7
-
8
- declare function pageReducer(state: AllPages | undefined, action: PageReducerAction | UnknownAction): AllPages;
9
- declare function superglueReducer(state: Partial<SuperglueState> | undefined, action: SuperglueReducerAction | UnknownAction): Partial<SuperglueState>;
10
- declare const rootReducer: {
11
- superglue: typeof superglueReducer;
12
- pages: typeof pageReducer;
13
- };
5
+ import * as _reduxjs_toolkit from '@reduxjs/toolkit';
14
6
 
15
7
  declare function getIn(node: JSONMappable, path: Keypath): JSONValue;
16
8
 
17
9
  declare function urlToPageKey(url: string): PageKey;
18
10
 
19
- declare const BEFORE_FETCH = "@@superglue/BEFORE_FETCH";
20
- declare const BEFORE_VISIT = "@@superglue/BEFORE_VISIT";
21
- declare const BEFORE_REMOTE = "@@superglue/BEFORE_REMOTE";
22
- declare const SAVE_RESPONSE = "@@superglue/SAVE_RESPONSE";
11
+ declare const NavigationContext: React.Context<NavigationContextProps>;
12
+ declare const NavigationProvider: React.ForwardRefExoticComponent<NavigationProviderProps & React.RefAttributes<{
13
+ navigateTo: NavigateTo | null;
14
+ }>>;
15
+
23
16
  declare const GRAFTING_ERROR = "@@superglue/GRAFTING_ERROR";
24
17
  declare const GRAFTING_SUCCESS = "@@superglue/GRAFTING_SUCCESS";
25
- declare const HISTORY_CHANGE = "@@superglue/HISTORY_CHANGE";
26
- declare const REMOVE_PAGE = "@@superglue/REMOVE_PAGE";
27
- declare const COPY_PAGE = "@@superglue/COPY_PAGE";
28
- declare const UPDATE_FRAGMENTS = "@@superglue/UPDATE_FRAGMENTS";
18
+ declare const saveResponse: _reduxjs_toolkit.ActionCreatorWithPreparedPayload<[{
19
+ pageKey: string;
20
+ page: VisitResponse;
21
+ }], {
22
+ pageKey: string;
23
+ page: VisitResponse;
24
+ }, "@@superglue/SAVE_RESPONSE", never, never>;
25
+ declare const updateFragments: _reduxjs_toolkit.ActionCreatorWithPayload<{
26
+ name: string;
27
+ path: Keypath;
28
+ pageKey: PageKey;
29
+ value: JSONMappable;
30
+ previousValue?: JSONMappable;
31
+ }, string>;
32
+ declare const copyPage: _reduxjs_toolkit.ActionCreatorWithPayload<{
33
+ from: PageKey;
34
+ to: PageKey;
35
+ }, string>;
36
+ declare const removePage: _reduxjs_toolkit.ActionCreatorWithPayload<{
37
+ pageKey: PageKey;
38
+ }, string>;
39
+ declare const beforeFetch: _reduxjs_toolkit.ActionCreatorWithPayload<{
40
+ fetchArgs: FetchArgs;
41
+ }, string>;
42
+ declare const beforeVisit: _reduxjs_toolkit.ActionCreatorWithPayload<{
43
+ currentPageKey: PageKey;
44
+ fetchArgs: FetchArgs;
45
+ }, string>;
46
+ declare const beforeRemote: _reduxjs_toolkit.ActionCreatorWithPayload<{
47
+ currentPageKey: PageKey;
48
+ fetchArgs: FetchArgs;
49
+ }, string>;
29
50
 
30
- declare const fragmentMiddleware: Middleware<unknown, RootState, Dispatch>;
51
+ declare function useSuperglue(): SuperglueState;
52
+ declare function useContent<T = JSONMappable>(): T;
31
53
 
32
- interface ApplicationProps {
33
- initialPage: VisitResponse;
34
- baseUrl: string;
35
- path: string;
36
- appEl: HTMLElement;
37
- store?: SuperglueStore;
38
- }
39
- declare abstract class ApplicationBase extends React.Component<ApplicationProps> {
40
- private hasWindow;
41
- private navigatorRef;
42
- private initialPageKey;
43
- private store;
44
- private history;
45
- private connectedMapping;
46
- private ujsHandlers;
47
- private visit;
48
- private remote;
49
- constructor(props: ApplicationProps);
50
- abstract visitAndRemote(navigatorRef: React.RefObject<Nav>, store: SuperglueStore): {
51
- visit: Visit;
52
- remote: Remote;
53
- };
54
- componentDidMount(): void;
55
- componentWillUnmount(): void;
56
- abstract buildStore(initialState: {
57
- pages: AllPages;
58
- [key: string]: JSONValue;
59
- }, reducer: typeof rootReducer): SuperglueStore;
60
- createHistory(): BrowserHistory;
61
- abstract mapping(): Record<string, React.ComponentType>;
62
- render(): JSX.Element;
63
- }
54
+ declare const prepareStore: (store: SuperglueStore, initialPage: VisitResponse, path: string) => void;
55
+ declare const setup: ({ initialPage, baseUrl, path, store, buildVisitAndRemote, history, navigatorRef, }: SetupProps) => {
56
+ visit: ApplicationVisit;
57
+ remote: ApplicationRemote;
58
+ nextHistory: history.History;
59
+ initialPageKey: string;
60
+ ujs: Handlers;
61
+ };
62
+ declare function Application({ initialPage, baseUrl, path, store, buildVisitAndRemote, history, mapping, ...rest }: ApplicationProps): React.JSX.Element;
64
63
 
65
- export { ApplicationBase, BEFORE_FETCH, BEFORE_REMOTE, BEFORE_VISIT, COPY_PAGE, GRAFTING_ERROR, GRAFTING_SUCCESS, HISTORY_CHANGE, REMOVE_PAGE, SAVE_RESPONSE, UPDATE_FRAGMENTS, fragmentMiddleware, getIn, urlToPageKey };
64
+ export { Application, ApplicationProps, ApplicationRemote, ApplicationVisit, FetchArgs, GRAFTING_ERROR, GRAFTING_SUCCESS, Handlers, JSONMappable, JSONValue, Keypath, NavigateTo, NavigationContext, NavigationContextProps, NavigationProvider, NavigationProviderProps, PageKey, SetupProps, SuperglueState, SuperglueStore, VisitResponse, beforeFetch, beforeRemote, beforeVisit, copyPage, getIn, prepareStore, removePage, saveResponse, setup, updateFragments, urlToPageKey, useContent, useSuperglue };