0.2.62 • Published 1 year ago

@the-wrench-io/hdes-ide v0.2.62

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
1 year ago

git config

git update-index --assume-unchanged tsconfig.json git update-index --no-assume-unchanged tsconfig.json

installation

yarn add @the-wrench-io/hdes-ide

dependencies

"@emotion/react": "^11.0.0",
"@emotion/styled": "^11.0.0",
"@material-ui/core": "^5.0.0-alpha.37",
"@material-ui/icons": "^5.0.0-alpha.37",
"@material-ui/styles": "^5.0.0-alpha.35",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-intl": "^5.17.2"

react integration

imports

import { Resource, Hdes } from '@the-wrench-io/hdes-ide';

backend integration

const store: Hdes.Store = {
  fetch<T>(path: string, req?: RequestInit): Promise<T> {
    if (!path) {
      throw new Error("can't fetch with undefined url")
    }

    const defRef: RequestInit = {
      method: "GET",
      credentials: 'same-origin',
      headers: {
        "Content-Type": "application/json;charset=UTF-8"
      }
    };
    
    if(init.csrf) {
      const headers: Record<string, string> = defRef.headers as any;
      headers[init.csrf.key] = init.csrf.value;
    }

    const url = init.url;
    const finalInit: RequestInit = Object.assign(defRef, req ? req : {});


    return fetch(url + path, finalInit)
      .then(response => {
        if (response.status === 302) {
          return null;
        }
        if (!response.ok) {
          return response.json().then(data => {
            console.error(data);
            throw new Hdes.StoreError({
              text: response.statusText,
              status: response.status,
              errors: data
            });
          });
        }
        return response.json();
      })
  }
}

Material-UI, intl, editor integration

<StyledEngineProvider injectFirst>
    <ThemeProvider theme={theme}>
      <IntlProvider locale={init.locale} messages={messages[init.locale]}>
        <Resource.Editor store={store} theme='dark' />
      </IntlProvider>
    </ThemeProvider>
  </StyledEngineProvider> 
0.2.62

1 year ago

0.2.61

2 years ago

0.2.60

2 years ago

0.2.59

2 years ago

0.2.58

3 years ago

0.2.57

3 years ago

0.2.56

3 years ago

0.2.55

3 years ago

0.2.54

3 years ago

0.2.53

3 years ago

0.2.52

3 years ago

0.2.51

3 years ago

0.2.50

3 years ago

0.2.49

3 years ago

0.2.48

3 years ago

0.2.47

3 years ago

0.2.41

3 years ago

0.2.40

3 years ago

0.2.46

3 years ago

0.2.45

3 years ago

0.2.44

3 years ago

0.2.43

3 years ago

0.2.42

3 years ago

0.2.39

3 years ago

0.2.38

3 years ago

0.2.37

3 years ago

0.2.27

4 years ago

0.2.26

4 years ago

0.2.25

4 years ago

0.2.24

4 years ago

0.2.23

4 years ago

0.2.22

4 years ago

0.2.21

4 years ago

0.2.30

4 years ago

0.2.36

3 years ago

0.2.35

3 years ago

0.2.34

3 years ago

0.2.33

3 years ago

0.2.32

4 years ago

0.2.31

4 years ago

0.2.29

4 years ago

0.2.28

4 years ago

0.2.20

4 years ago

0.2.19

4 years ago

0.2.18

4 years ago

0.2.17

4 years ago

0.2.16

4 years ago

0.2.15

4 years ago

0.2.14

4 years ago

0.2.13

4 years ago

0.2.12

4 years ago

0.2.11

4 years ago

0.2.10

4 years ago

0.2.9

4 years ago

0.2.7

4 years ago

0.2.8

4 years ago

0.2.6

4 years ago

0.2.5

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.4

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.4

4 years ago

1.0.0

4 years ago