diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 820685e..25a8666 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -35,6 +35,7 @@ jobs: curl -L -s https://unpkg.com/@wq/markdown > docs/js/markdown.js sed -i "s/^import\(.*\)https:\/\/unpkg.com\/wq/import\1.\/wq.js/" docs/js/*.js sed -i "s/^import\(.*\)https:\/\/unpkg.com\/@wq\/markdown/import\1.\/markdown.js/" docs/js/*.js + sed -i "s/^import\(.*\)https:\/\/unpkg.com\/maplibre-gl/import\1.\/maplibre-gl.js/" docs/js/*.js - name: Build with Jekyll uses: actions/jekyll-build-pages@v1 with: diff --git a/README.md b/README.md index e9cf387..79eb2e9 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ npx create-react-app myproject --template @wq ### CDN ```html ``` diff --git a/docs/js/$index.js b/docs/js/$index.js index 6b0ad5b..befc60a 100644 --- a/docs/js/$index.js +++ b/docs/js/$index.js @@ -117,6 +117,13 @@ wq.use({ }, }); +wq.use({ + name: 'auth', + reducer(state) { + return state || {}; + } +}); + function Icon({ data }) { return React.createElement( 'svg', diff --git a/docs/js/codepen.js b/docs/js/codepen.js index b753cf1..db6446c 100644 --- a/docs/js/codepen.js +++ b/docs/js/codepen.js @@ -1,8 +1,8 @@ import { modules } from 'https://unpkg.com/wq'; -import { renderers } from 'https://unpkg.com/@wq/markdown'; +import { components } from 'https://unpkg.com/@wq/markdown'; const React = modules.react; -const Code = renderers.code; +const Code = components.code; const COMMENT = `// wq.init(config).then(...); @@ -37,6 +37,12 @@ wq.use({ } } }); +wq.use({ + name: 'auth', + reducer(state) { + return state || {}; + } +}); wq.init({ ...config, router: {base_url: window.location.pathname}, @@ -79,9 +85,8 @@ function wrapCode(code) { } export default function CodeDetect(props) { - const { language, value } = props; + const { children: value } = props; if ( - (language === 'javascript' || language === 'js') && value.indexOf("import wq from './wq.js';") !== -1 && value.indexOf('wq.init(config).then(...);') !== -1 ) { @@ -90,7 +95,7 @@ export default function CodeDetect(props) { } else { return React.createElement(Code, { ...props, - value: '// Warning: Failed to initialize CodePen!\n\n' + value, + children: '// Warning: Failed to initialize CodePen!\n\n' + value, }); } } else { diff --git a/docs/js/maplibre-gl.js b/docs/js/maplibre-gl.js new file mode 100644 index 0000000..d06b9e6 --- /dev/null +++ b/docs/js/maplibre-gl.js @@ -0,0 +1 @@ +window.maplibregl = {};