diff --git a/.codedoc/build.ts b/.codedoc/build.ts deleted file mode 100644 index 8076303..0000000 --- a/.codedoc/build.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { build } from '@codedoc/core'; - -import { config } from './config'; -import { installTheme$ } from './content/theme'; -import { content } from './content'; - - -build(config, content, installTheme$, { - resolve: { - modules: ['.codedoc/node_modules'] - }, - resolveLoader: { - modules: ['.codedoc/node_modules'] - } -}); diff --git a/.codedoc/components/account/account-prop/code.tsx b/.codedoc/components/account/account-prop/code.tsx deleted file mode 100644 index aa4d500..0000000 --- a/.codedoc/components/account/account-prop/code.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import { Renderer, styled } from '@connectv/html'; -import { ThemedComponentThis } from '@connectv/jss-theme'; -import { CodeStyle } from '@codedoc/core/components'; -import { CodedocTheme } from '@codedoc/core/transport'; -import { transport } from '@connectv/sdh/transport'; -import { map } from 'rxjs/operators'; - -import { AccountService as service } from '../account.service'; -import { AccountPropOptions } from './types'; - - -export function AccountPropCode( - this: ThemedComponentThis, - options: AccountPropOptions, - renderer: Renderer -) { - renderer = renderer.plug(this.theme.styled(CodeStyle)); - const classes = this.theme.classes(CodeStyle); - const prop = service.instance().data.pipe(map(data => { - if (!data) return options.empty || ''; - else if (options.fallback) return data[options.prop] || data[options.fallback] || options.empty || ''; - else return data[options.prop] || options.empty || ''; - })); - - return
-    
-      
- 1 - {prop} -
-
-
-} - - -export const AccountPropCode$ = /*#__PURE__*/transport(AccountPropCode); diff --git a/.codedoc/components/account/account-prop/index.ts b/.codedoc/components/account/account-prop/index.ts deleted file mode 100644 index d5d97fc..0000000 --- a/.codedoc/components/account/account-prop/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { AccountProp$ } from './inline'; -export { AccountPropCode$ } from './code'; \ No newline at end of file diff --git a/.codedoc/components/account/account-prop/inline.tsx b/.codedoc/components/account/account-prop/inline.tsx deleted file mode 100644 index 70b8e9a..0000000 --- a/.codedoc/components/account/account-prop/inline.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { RendererLike } from '@connectv/html'; -import { transport } from '@connectv/sdh/transport'; -import { map } from 'rxjs/operators'; - -import { AccountService as service } from '../account.service'; -import { AccountPropOptions } from './types'; - - -export function AccountProp(options: AccountPropOptions, renderer: RendererLike) { - return {service.instance().data.pipe(map(data => { - if (!data) return options.empty || ''; - else if (options.fallback) return data[options.prop] || data[options.fallback] || options.empty || ''; - else return data[options.prop] || options.empty || ''; - }))} -} - - -export const AccountProp$ = /*#__PURE__*/transport(AccountProp); diff --git a/.codedoc/components/account/account-prop/types.ts b/.codedoc/components/account/account-prop/types.ts deleted file mode 100644 index 0c3f385..0000000 --- a/.codedoc/components/account/account-prop/types.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { AccountData } from '../types'; - -export interface AccountPropOptions { - prop: keyof(AccountData); - fallback?: keyof(AccountData); - empty?: string; -} diff --git a/.codedoc/components/account/account.service.ts b/.codedoc/components/account/account.service.ts deleted file mode 100644 index aa32f48..0000000 --- a/.codedoc/components/account/account.service.ts +++ /dev/null @@ -1,163 +0,0 @@ -import { ajax } from 'rxjs/ajax'; -import { BehaviorSubject } from 'rxjs'; - -import { AccountStatus, AccountData } from './types'; - - -const _LS_Login_Token_Key = '__coding_blog_login_token'; -const _Q_Login_Token_Key = 'login_token'; -const _API_URL = 'https://api.coding.blog/'; - - -interface AccountResponse { - user: { - email: string; - name?: string; - blog?: { - name: string; - git?: { - url: string; - }, - publish_url?: string; - } - } -} - -interface WebhookResponse { - result: { - publish_url: string; - } -} - -export class AccountService { - static __instance: AccountService; - - static instance() { - if (!this.__instance) this.__instance = new AccountService(); - return this.__instance; - } - - - readonly data = new BehaviorSubject(undefined); - readonly status = new BehaviorSubject('NotLoggedIn'); - public token: string | undefined; - - constructor() { - this.login(); - } - - tokenFromQuery() { return new URLSearchParams(window.location.search).get(_Q_Login_Token_Key) || undefined; } - tokenFromLocal() { return localStorage.getItem(_LS_Login_Token_Key) || undefined; } - removeLocalToken() { localStorage.removeItem(_LS_Login_Token_Key); } - storeTokenLocally(token: string) { localStorage.setItem(_LS_Login_Token_Key, token); } - - login() { - if (this.status.value === 'NotLoggedIn') { - if ((this.token = this.tokenFromQuery() || this.tokenFromLocal())) { - const token = this.token; - this.fetchData() - .then(() => { - this.storeTokenLocally(token); - this.token = token; - }) - .catch(() => { - this.token = undefined; - this.removeLocalToken(); - }); - } - } - } - - async fetchData() { - if (this.token) { - this.status.next('Checking'); - await new Promise((resolve, reject) => { - ajax.getJSON(_API_URL + `/account?token=${this.token}`).subscribe( - response => { - if (response.user) { - const user: AccountData = { - email: response.user.email, - name: response.user.name, - }; - - if (response.user.blog) { - user.domain = response.user.blog.name + '.coding.blog'; - if (response.user.blog.git) user.repo = response.user.blog.git.url; - if (response.user.blog.publish_url) user.publishUrl = response.user.blog.publish_url; - } - - this.data.next(user); // TODO: complete this - this.status.next('LoggedIn'); - resolve(); - } else { - this.status.next('NotLoggedIn'); - reject(); - } - }, - err => { - this.status.next('NotLoggedIn'); - reject(err); - }, - ); - }); - } - } - - logout() { - this.status.next('NotLoggedIn'); - this.removeLocalToken(); - } - - async sendLoginEmail(email: string) { - await new Promise((resolve, reject) => { - ajax.post(_API_URL + `/login?email=${encodeURIComponent(email)}`).subscribe( - () => resolve(), - (error) => reject(error), - ); - }); - } - - async updateName(name: string) { - await new Promise((resolve, reject) => { - ajax.put(_API_URL + `/user/name?name=${encodeURIComponent(name)}&token=${this.token}`) - .subscribe( - () => { - this.data.next(Object.assign({}, this.data.value, { name })); - resolve(); - }, - err => reject(err), - ) - }); - } - - async bindRepo(url: string) { - await new Promise((resolve, reject) => { - ajax.post(_API_URL + `/blog/git?git_url=${encodeURIComponent(url)}&token=${this.token}`) - .subscribe( - response => { - this.data.next(Object.assign({}, this.data.value, { - repo: url, - publishUrl: response.response.result.publish_url, - })); - resolve(); - }, - err => reject(err) - ); - }); - } - - async refreshPublishUrl() { - await new Promise((resolve, reject) => { - ajax.getJSON(_API_URL + `/webhook/create?token=${this.token}&refresh=true`) - .subscribe( - response => { - this.data.next(Object.assign({}, this.data.value, { - publishUrl: response.result.publish_url - })); - resolve(); - }, - err => reject(err) - ); - }); - } -} diff --git a/.codedoc/components/account/bind-repo/button.tsx b/.codedoc/components/account/bind-repo/button.tsx deleted file mode 100644 index a107780..0000000 --- a/.codedoc/components/account/bind-repo/button.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { RendererLike } from '@connectv/html'; -import { transport } from '@connectv/sdh/transport'; -import { ThemedComponentThis } from '@connectv/jss-theme'; -import { ButtonStyle } from '@codedoc/core/components'; -import { CodedocTheme } from '@codedoc/core/transport'; - -import { BindRepoOverlay } from './overlay'; - - -export interface BindRepoButtonOptions { - icon?: 'true' | 'false' -} - - -export function BindRepoButton( - this: ThemedComponentThis, - options: BindRepoButtonOptions, - renderer: RendererLike -) { - const classes = this.theme.classes(ButtonStyle); - const open = () => renderer.render().on(document.body); - if (options.icon === 'true') - return ; - else - return ; -} - - -export const BindRepoButton$ = /*#__PURE__*/transport(BindRepoButton); \ No newline at end of file diff --git a/.codedoc/components/account/bind-repo/index.ts b/.codedoc/components/account/bind-repo/index.ts deleted file mode 100644 index 6dccd10..0000000 --- a/.codedoc/components/account/bind-repo/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { BindRepoButton$ } from './button'; \ No newline at end of file diff --git a/.codedoc/components/account/bind-repo/overlay.tsx b/.codedoc/components/account/bind-repo/overlay.tsx deleted file mode 100644 index 386bfb9..0000000 --- a/.codedoc/components/account/bind-repo/overlay.tsx +++ /dev/null @@ -1,65 +0,0 @@ -import { RendererLike, ref, ComponentThis } from '@connectv/html'; -import { Loading, Overlay } from '@codedoc/core/components'; -import { not, or } from 'rxmetics'; -import { BehaviorSubject } from 'rxjs'; -import { map } from 'rxjs/operators'; - -import { ActionOverlay } from '../../action-overlay'; -import { AccountService } from '../account.service'; - - -const repoRegex = /^(https)(:(\/\/)?)([\w\.@\:/\-~]+)(\/)?$/; - -export function BindRepoOverlay(this: ComponentThis, _: any, renderer: RendererLike) { - const close = ref<() => void>(); - const url = new BehaviorSubject(''); - const loading = new BehaviorSubject(false); - const service = AccountService.instance(); - const valid = url.pipe(map(v => repoRegex.test(v))); - - this.track({ - bind() { - setTimeout(() => { - if (service.data.value) url.next(service.data.value.repo || ''); - }, 10); - } - }); - - return { - loading.next(true); - service.bindRepo(url.value) - .then(() => { - loading.next(false); - close.$(); - }) - .catch(() => { - loading.next(false); - close.$(); - renderer.render( - - error
- Oops
-

event.stopPropagation()}> - Something went wrong. Please try again in a minute or contact us at - contact@connect-platform.com. -

-
- ).on(document.body); - }); - }}> - - {loading.pipe(map(v => v ? 'Binding ...' : 'Bind Repo'))} - - }> -

- Bind the Git repo of your blog to {service.data.pipe(map(d => d?.domain))}. - We will clone this repo, build it - using - CODEDOC - and - distribute the generated files to our CDNs for publishing your blog. -

- -
-} diff --git a/.codedoc/components/account/edit-name/button.tsx b/.codedoc/components/account/edit-name/button.tsx deleted file mode 100644 index ce79cae..0000000 --- a/.codedoc/components/account/edit-name/button.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { RendererLike } from '@connectv/html'; -import { transport } from '@connectv/sdh/transport'; -import { ThemedComponentThis } from '@connectv/jss-theme'; -import { ButtonStyle } from '@codedoc/core/components'; -import { CodedocTheme } from '@codedoc/core/transport'; - -import { EditNameOverlay } from './overlay'; - - -export function EditNameButton( - this: ThemedComponentThis, - _: any, - renderer: RendererLike -) { - const classes = this.theme.classes(ButtonStyle); - return ; -} - - -export const EditNameButton$ = /*#__PURE__*/transport(EditNameButton); \ No newline at end of file diff --git a/.codedoc/components/account/edit-name/index.ts b/.codedoc/components/account/edit-name/index.ts deleted file mode 100644 index 726f073..0000000 --- a/.codedoc/components/account/edit-name/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { EditNameButton$ } from './button'; \ No newline at end of file diff --git a/.codedoc/components/account/edit-name/overlay.tsx b/.codedoc/components/account/edit-name/overlay.tsx deleted file mode 100644 index 59cdbea..0000000 --- a/.codedoc/components/account/edit-name/overlay.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import { RendererLike, ref, ComponentThis } from '@connectv/html'; -import { Loading, Overlay } from '@codedoc/core/components'; -import { not } from 'rxmetics'; -import { BehaviorSubject } from 'rxjs'; -import { map } from 'rxjs/operators'; - -import { ActionOverlay } from '../../action-overlay'; -import { AccountService } from '../account.service'; - - -export function EditNameOverlay(this: ComponentThis, _: any, renderer: RendererLike) { - const close = ref<() => void>(); - const name = new BehaviorSubject(''); - const loading = new BehaviorSubject(false); - const service = AccountService.instance(); - - this.track({ - bind() { - setTimeout(() => { - if (service.data.value) name.next(service.data.value.name || ''); - }, 10); - } - }); - - return { - loading.next(true); - service.updateName(name.value) - .then(() => { - loading.next(false); - close.$(); - }) - .catch(() => { - loading.next(false); - close.$(); - renderer.render( - - error
- Oops
-

event.stopPropagation()}> - Something went wrong. Please try again in a minute or contact us at - contact@connect-platform.com. -

-
- ).on(document.body); - }); - }}> - - {loading.pipe(map(v => v ? 'Updating ...' : 'Update Name'))} - - }> -

- We will use this name to refer to you in a friendlier manner on emails. - It will NOT be shared by any third-party. -

- -
-} diff --git a/.codedoc/components/account/login/button.tsx b/.codedoc/components/account/login/button.tsx deleted file mode 100644 index 10f558d..0000000 --- a/.codedoc/components/account/login/button.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { RendererLike } from '@connectv/html'; -import { transport } from '@connectv/sdh/transport'; -import { ThemedComponentThis } from '@connectv/jss-theme'; -import { ButtonStyle } from '@codedoc/core/components'; -import { CodedocTheme } from '@codedoc/core/transport'; - -import { LoginOverlay } from './overlay'; - - -export function LoginButton( - this: ThemedComponentThis, - _: any, - renderer: RendererLike -) { - const classes = this.theme.classes(ButtonStyle); - - return ; -} - - -export const LoginButton$ = /*#__PURE__*/transport(LoginButton); \ No newline at end of file diff --git a/.codedoc/components/account/login/index.ts b/.codedoc/components/account/login/index.ts deleted file mode 100644 index b931743..0000000 --- a/.codedoc/components/account/login/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { LoginButton$ } from './button'; \ No newline at end of file diff --git a/.codedoc/components/account/login/overlay.tsx b/.codedoc/components/account/login/overlay.tsx deleted file mode 100644 index c5dbb74..0000000 --- a/.codedoc/components/account/login/overlay.tsx +++ /dev/null @@ -1,75 +0,0 @@ -import { RendererLike, ref } from '@connectv/html'; -import { Loading, Overlay } from '@codedoc/core/components'; -import { not, or } from 'rxmetics'; -import { BehaviorSubject } from 'rxjs'; -import { map } from 'rxjs/operators'; - -import { JoinBetaOverlay } from '../../join-beta'; -import { ActionOverlay } from '../../action-overlay'; -import { AccountService } from '../account.service'; - - -const emailRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; - -export function LoginOverlay(_: any, renderer: RendererLike) { - const close = ref<() => void>(); - const email = new BehaviorSubject(''); - const loading = new BehaviorSubject(false); - const valid = email.pipe(map(v => emailRegex.test(v))); - const service = AccountService.instance(); - - return { - loading.next(true); - service.sendLoginEmail(email.value) - .then(() => { - loading.next(false); - close.$(); - renderer.render( - email
- Login Link Emailed
-

- We've emailed you a login link. Open your email account and follow that link - to log in. Be sure to check your spam folder. -

-
).on(document.body); - }) - .catch(() => { - loading.next(false); - close.$(); - renderer.render( - - error
- Oops
-

event.stopPropagation()}> - Something went wrong. Please try again in a minute or contact us at - contact@connect-platform.com. -

-
- ).on(document.body); - }); - }}> - - {loading.pipe(map(v => v ? 'Logging in ...' : 'Log In'))} - - }> -

- Enter your email address and we'll send a login link to given email address. - Open that link in a browser and you will be logged in. - -

- - Since we are in alpha stage, you will only recieve a login link if you have - an account, which you should have recieved an email about. If not, you perhaps - do not have an account yet, but you can { - close.$(); - renderer.render().on(document.body); - }}> - sign up for our beta waiting list - and we will inform you via email when your account is created. -

- -
-} diff --git a/.codedoc/components/account/logout/index.tsx b/.codedoc/components/account/logout/index.tsx deleted file mode 100644 index ad7501a..0000000 --- a/.codedoc/components/account/logout/index.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { RendererLike } from '@connectv/html'; -import { transport } from '@connectv/sdh/transport'; -import { ThemedComponentThis } from '@connectv/jss-theme'; -import { ButtonStyle } from '@codedoc/core/components'; -import { CodedocTheme } from '@codedoc/core/transport'; - -import { AccountService as service } from '../account.service'; - - -export function LogoutButton( - this: ThemedComponentThis, - _: any, - renderer: RendererLike -) { - const classes = this.theme.classes(ButtonStyle); - return ; -} - - -export const LogoutButton$ = /*#__PURE__*/transport(LogoutButton); \ No newline at end of file diff --git a/.codedoc/components/account/prop-bound/control.tsx b/.codedoc/components/account/prop-bound/control.tsx deleted file mode 100644 index 0befa10..0000000 --- a/.codedoc/components/account/prop-bound/control.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { RendererLike, ComponentThis, trackable, ref } from '@connectv/html'; -import { transport } from '@connectv/sdh/transport'; -import { tap } from 'rxjs/operators'; - -import { AccountPropBoundOptions } from './types'; -import { AccountService as service } from '../account.service'; - - -export function ACPBControl( - this: ComponentThis, - options: AccountPropBoundOptions, - renderer: RendererLike -) { - const _ref = ref(); - this.track(trackable(service.instance().data.pipe( - tap(data => { - const parent = _ref.$.parentElement as HTMLElement; - if (data) { - if (options.unset === 'true') { - if (!data[options.prop]) parent.hidden = false; - else parent.hidden = true; - } - else { - if (!!data[options.prop]) parent.hidden = false; - else parent.hidden = true; - } - } - else parent.hidden = true; - }) - ))); - return
; -} - - -export const ACPBControl$ = /*#__PURE__*/transport(ACPBControl); \ No newline at end of file diff --git a/.codedoc/components/account/prop-bound/index.tsx b/.codedoc/components/account/prop-bound/index.tsx deleted file mode 100644 index 92feb79..0000000 --- a/.codedoc/components/account/prop-bound/index.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { RendererLike } from '@connectv/html'; -import { AccountPropBoundOptions } from './types'; - -import { ACPBControl$ } from './control'; - - -export function AccountPropBound( - options: AccountPropBoundOptions, - renderer: RendererLike, - content: any -) { - return -} diff --git a/.codedoc/components/account/prop-bound/types.ts b/.codedoc/components/account/prop-bound/types.ts deleted file mode 100644 index 6b46211..0000000 --- a/.codedoc/components/account/prop-bound/types.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { AccountData } from '../types'; - -export interface AccountPropBoundOptions { - prop: keyof(AccountData); - unset?: 'true' | 'false'; -} diff --git a/.codedoc/components/account/publish-blog/button.tsx b/.codedoc/components/account/publish-blog/button.tsx deleted file mode 100644 index 55aaa67..0000000 --- a/.codedoc/components/account/publish-blog/button.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { RendererLike } from '@connectv/html'; -import { transport } from '@connectv/sdh/transport'; -import { ThemedComponentThis } from '@connectv/jss-theme'; -import { ButtonStyle } from '@codedoc/core/components'; -import { CodedocTheme } from '@codedoc/core/transport'; -import { not } from 'rxmetics'; - -import { PublishOverlay } from './overlay'; -import { PublishService } from '../publish.service'; - - -export function PublishButton( - this: ThemedComponentThis, - _: any, - renderer: RendererLike -) { - const classes = this.theme.classes(ButtonStyle); - const service = PublishService.instance(); - - return ; -} - - -export const PublishButton$ = /*#__PURE__*/transport(PublishButton); \ No newline at end of file diff --git a/.codedoc/components/account/publish-blog/index.ts b/.codedoc/components/account/publish-blog/index.ts deleted file mode 100644 index 322b1b0..0000000 --- a/.codedoc/components/account/publish-blog/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { PublishButton$ } from './button'; -export { RefreshPublishWebhookButton$ } from './refresh-button'; \ No newline at end of file diff --git a/.codedoc/components/account/publish-blog/overlay.tsx b/.codedoc/components/account/publish-blog/overlay.tsx deleted file mode 100644 index 1d5ed07..0000000 --- a/.codedoc/components/account/publish-blog/overlay.tsx +++ /dev/null @@ -1,68 +0,0 @@ -import { RendererLike, ref } from '@connectv/html'; -import { Loading, Overlay } from '@codedoc/core/components'; -import { not } from 'rxmetics'; -import { BehaviorSubject } from 'rxjs'; -import { map } from 'rxjs/operators'; - -import { ActionOverlay } from '../../action-overlay'; -import { AccountPropCode } from '../account-prop/code'; -import { AccountProp } from '../account-prop/inline'; -import { PublishService } from '../publish.service'; - - -export function PublishOverlay(_: any, renderer: RendererLike) { - const close = ref<() => void>(); - const loading = new BehaviorSubject(false); - const service = PublishService.instance(); - - return - - - - } - > -

- Are you sure you want to publish your blog? The following repo will be cloned: - - and the latest content on its master branch will be published to - -

-
-} diff --git a/.codedoc/components/account/publish-blog/refresh-button.tsx b/.codedoc/components/account/publish-blog/refresh-button.tsx deleted file mode 100644 index 7a1408f..0000000 --- a/.codedoc/components/account/publish-blog/refresh-button.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { RendererLike } from '@connectv/html'; -import { transport } from '@connectv/sdh/transport'; -import { ThemedComponentThis } from '@connectv/jss-theme'; -import { ButtonStyle } from '@codedoc/core/components'; -import { CodedocTheme } from '@codedoc/core/transport'; - -import { RefreshPWOverlay } from './refresh-overlay'; - - -export function RefreshPublishWebhookButton( - this: ThemedComponentThis, - _: any, - renderer: RendererLike -) { - const classes = this.theme.classes(ButtonStyle); - return ; -} - - -export const RefreshPublishWebhookButton$ = /*#__PURE__*/transport(RefreshPublishWebhookButton); \ No newline at end of file diff --git a/.codedoc/components/account/publish-blog/refresh-overlay.tsx b/.codedoc/components/account/publish-blog/refresh-overlay.tsx deleted file mode 100644 index fbd4bfb..0000000 --- a/.codedoc/components/account/publish-blog/refresh-overlay.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import { RendererLike, ref } from '@connectv/html'; -import { Loading, Overlay } from '@codedoc/core/components'; -import { not } from 'rxmetics'; -import { BehaviorSubject } from 'rxjs'; -import { map } from 'rxjs/operators'; - -import { ActionOverlay } from '../../action-overlay'; -import { AccountService } from '../account.service'; - - -export function RefreshPWOverlay(_: any, renderer: RendererLike) { - const close = ref<() => void>(); - const loading = new BehaviorSubject(false); - const service = AccountService.instance(); - - return - - - - } - > -

- Are you sure you want to refresh your publish webhook? Your current webhook will no longer work, - which means any services that call upon it will also fail to publish your blog and recieve an error - instead. -

-
-} diff --git a/.codedoc/components/account/publish-status/error.tsx b/.codedoc/components/account/publish-status/error.tsx deleted file mode 100644 index 3b1f9cd..0000000 --- a/.codedoc/components/account/publish-status/error.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { RendererLike } from '@connectv/html'; - -import { PublishErrors } from '../publish.service'; - - -export function ErrorMsg({ errors } : { errors: PublishErrors }, renderer: RendererLike) { - const anchor = errors[Object.keys(errors).length]; - if (anchor.stage === 'git-clone') { - return Repo cannot be cloned.; - } else if (anchor.stage === 'install-codedoc') { - return Dependencies cannot be installed.; - } else if (anchor.stage === 'build-codedoc') { - return Project cannot be built.; - } else { - return Unknown error.; - } -} \ No newline at end of file diff --git a/.codedoc/components/account/publish-status/index.tsx b/.codedoc/components/account/publish-status/index.tsx deleted file mode 100644 index 540669b..0000000 --- a/.codedoc/components/account/publish-status/index.tsx +++ /dev/null @@ -1,88 +0,0 @@ -import { interval, combineLatest } from 'rxjs'; -import { map } from 'rxjs/operators'; -import { truthy, not } from 'rxmetics'; -import { RendererLike, Conditional } from '@connectv/html'; -import { transport } from '@connectv/sdh/transport'; -import { ThemedComponentThis } from '@connectv/jss-theme'; -import { Loading, Icon, Button } from '@codedoc/core/components'; -import { CodedocTheme } from '@codedoc/core/transport'; - -import { PublishService } from '../publish.service'; -import { PublishStatusStyle } from './style'; -import { ErrorMsg } from './error'; - - - -export function PublishStatus( - this: ThemedComponentThis, - _: any, - renderer: RendererLike -) { - const classes = this.theme.classes(PublishStatusStyle); - const job = PublishService.instance().lastJob; - - return -} - - -export const PublishStatus$ = /*#__PURE__*/transport(PublishStatus); \ No newline at end of file diff --git a/.codedoc/components/account/publish-status/style.ts b/.codedoc/components/account/publish-status/style.ts deleted file mode 100644 index 4191574..0000000 --- a/.codedoc/components/account/publish-status/style.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { themedStyle } from '@connectv/jss-theme'; -import { CodedocTheme } from '@codedoc/core/transport'; - - -export const PublishStatusStyle = /*#__PURE__*/themedStyle(theme => ({ - container: { - display: 'flex', '&[hidden]': { display: 'none' }, - alignItems: 'center', - background: theme.light.border, - padding: 16, - marginBottom: 8, - borderRadius: 3, - - 'body.dark-mode-animate &': { transition: 'background .3s', }, - - 'body.dark &': { background: theme.dark.border, }, - '@media (prefers-color-scheme: dark)': { 'body:not(.dark-mode-animate) &': { background: theme.dark.border } }, - - '& code': { - background: 'none !important', - } - }, - - image: { - width: 32, - height: 32, - display: 'flex', - justifyContent: 'center', - alignItems: 'center', - marginRight: 16, - - '&.success': { - color: '#018383', - 'body.dark-mode-animate &': { transition: 'color .3s', }, - 'body.dark &': { color: '#bac964' }, - '@media (prefers-color-scheme: dark)': { 'body:not(.dark-mode-animate) &': { color: '#bac964' } }, - }, - - '&.error': { - color: '#e84a5f' - } - }, - - small: { - fontSize: 10, - opacity: .5 - } -})); \ No newline at end of file diff --git a/.codedoc/components/account/publish.service.ts b/.codedoc/components/account/publish.service.ts deleted file mode 100644 index 09982db..0000000 --- a/.codedoc/components/account/publish.service.ts +++ /dev/null @@ -1,169 +0,0 @@ -import { ajax } from 'rxjs/ajax'; -import { BehaviorSubject } from 'rxjs'; -import { map } from 'rxjs/operators'; - -import { AccountService } from './account.service'; - - -const _API_BASE = 'https://publish.coding.blog/'; -const _STATUS_URL= '/status'; -const _JOB_URL = '/job'; - -const _CHECK_NEW_JOB_INTERVAL = 13000; -const _CHECK_ACTIVE_JOB_STATUS_INTERVAL = 2000; - - -export type JobStatusType = 'completed' | 'failed' | 'running' | 'retrying'; -export type JobStageType = - 'git-clone' | 'copy-own-build-files' | 'install-codedoc' | 'build-codedoc' | 'upload-to-s3' | 'callback-url'; - - -export interface PublishError { - error: { - cmd: string; - code: number; - stack: string; - } - stage: JobStageType; -} - - -export type PublishErrors = {[_try: number]: PublishError}; - - -export interface PublishJob { - id: string; - status: JobStatusType; - created: Date; - tries?: number; - errors?: PublishErrors; -} - -interface StatusResponse { - data: { - last_job_id: string; - } -} - -interface JobResponse { - data: { - build_status: JobStatusType; - created_at: { - _seconds: number; - }, - errors?: PublishErrors; - tries?: number; - } -} - - -export class PublishService { - static __instance: PublishService; - - static instance() { - if (!this.__instance) this.__instance = new PublishService(); - return this.__instance; - } - - - account: AccountService; - readonly lastJob = new BehaviorSubject(undefined); - private lastJobUpdateSchedule: any; - - constructor() { - this.account = AccountService.instance(); - this.updateLastJob(); - this.account.data.subscribe(() => this.updateLastJob()); - } - - publishToken() { - return this.account.data.value?.publishUrl?.substr(35); - } - - async updateLastJob() { - const token = this.publishToken(); - const _prevjob = this.lastJob.value; - if (token) { - if (!_prevjob || _prevjob.status === 'completed' || _prevjob.status === 'failed') { - const jobId = await this.getLastJobId(token); - if (jobId && (!_prevjob || _prevjob.id !== jobId)) { - const job = await this.getJob(token, jobId); - if (job) { - this.lastJob.next({ - id: jobId, - status: job.status, - created: job.created, - errors: job.errors, - tries: job.tries, - }); - if (job.status === 'running' || job.status === 'retrying') - this.scheduleLastJobUpdate(_CHECK_ACTIVE_JOB_STATUS_INTERVAL); - else this.scheduleLastJobUpdate(_CHECK_NEW_JOB_INTERVAL); - } else this.scheduleLastJobUpdate(_CHECK_NEW_JOB_INTERVAL); - } - } else { - const job = await this.getJob(token, _prevjob.id); - if (job && job.status !== _prevjob.status) { - this.lastJob.next({ - id: _prevjob.id, - status: job.status, - created: job.created, - errors: job.errors, - tries: job.tries, - }); - if (job.status === 'running' || job.status === 'retrying') - this.scheduleLastJobUpdate(_CHECK_ACTIVE_JOB_STATUS_INTERVAL); - else this.scheduleLastJobUpdate(_CHECK_NEW_JOB_INTERVAL); - } else { - this.scheduleLastJobUpdate(_CHECK_ACTIVE_JOB_STATUS_INTERVAL); - } - } - } - } - - scheduleLastJobUpdate(millis: number) { - clearTimeout(this.lastJobUpdateSchedule); - this.lastJobUpdateSchedule = setTimeout(() => this.updateLastJob(), millis); - } - - async getLastJobId(token: string) { - try { - const res = await ajax.getJSON(_API_BASE + _STATUS_URL + `?token=${token}`).toPromise(); - return res?.data.last_job_id; - } catch {} - } - - async getJob(token: string, id: string) { - try { - const res = await ajax.getJSON(_API_BASE + _JOB_URL + `?token=${token}&job_id=${id}`).toPromise(); - if (res?.data) { - return { - status: res.data.build_status, - created: new Date(res.data.created_at._seconds * 1000), - tries: res.data.tries, - errors: res.data.errors, - } - } - } catch {} - } - - _canPublish() { - return this.lastJob.value?.status !== 'running' && this.lastJob.value?.status !== 'retrying'; - } - - canPublish() { - return this.lastJob.pipe(map(() => this._canPublish())); - } - - async publishBlog() { - if (this.account.data.value?.publishUrl && this._canPublish()) { - const url = this.account.data.value?.publishUrl; - await new Promise((resolve, reject) => { - ajax.post(url).subscribe(() => { - this.scheduleLastJobUpdate(50); - resolve(); - }, err => reject(err)); - }); - } - } -} diff --git a/.codedoc/components/account/status-bound/control.tsx b/.codedoc/components/account/status-bound/control.tsx deleted file mode 100644 index a3f353f..0000000 --- a/.codedoc/components/account/status-bound/control.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { RendererLike, ComponentThis, trackable, ref } from '@connectv/html'; -import { transport } from '@connectv/sdh/transport'; -import { tap } from 'rxjs/operators'; - -import { AccountStatusBoundOptions } from './types'; -import { AccountService as service } from '../account.service'; - - -export function ACSBControl( - this: ComponentThis, - options: AccountStatusBoundOptions, - renderer: RendererLike -) { - const _ref = ref(); - this.track(trackable(service.instance().status.pipe( - tap(status => { - const parent = _ref.$.parentElement as HTMLElement; - if (status === options.status) parent.hidden = false; - else parent.hidden = true; - }) - ))); - return
; -} - - -export const ACSBControl$ = /*#__PURE__*/transport(ACSBControl); \ No newline at end of file diff --git a/.codedoc/components/account/status-bound/index.tsx b/.codedoc/components/account/status-bound/index.tsx deleted file mode 100644 index 56c25c0..0000000 --- a/.codedoc/components/account/status-bound/index.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { RendererLike } from '@connectv/html'; -import { AccountStatusBoundOptions } from './types'; - -import { ACSBControl$ } from './control'; - - -export function AccountStatusBound( - options: AccountStatusBoundOptions, - renderer: RendererLike, - content: any -) { - return -} diff --git a/.codedoc/components/account/status-bound/types.ts b/.codedoc/components/account/status-bound/types.ts deleted file mode 100644 index c3527b0..0000000 --- a/.codedoc/components/account/status-bound/types.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { AccountStatus } from '../types'; - -export interface AccountStatusBoundOptions { - status: AccountStatus; -} diff --git a/.codedoc/components/account/types.ts b/.codedoc/components/account/types.ts deleted file mode 100644 index 28ca534..0000000 --- a/.codedoc/components/account/types.ts +++ /dev/null @@ -1,11 +0,0 @@ -export interface AccountData { - name?: string; - email: string; - domain?: string; - repo?: string; - publishUrl?: string; -} - - -export type AccountStatus = 'NotLoggedIn' | 'Checking' | 'LoggedIn'; - diff --git a/.codedoc/components/action-overlay/index.tsx b/.codedoc/components/action-overlay/index.tsx deleted file mode 100644 index 2fc8601..0000000 --- a/.codedoc/components/action-overlay/index.tsx +++ /dev/null @@ -1,70 +0,0 @@ -import { RendererLike, ref, Ref } from '@connectv/html'; -import { ThemedComponentThis } from '@connectv/jss-theme'; -import { CodedocTheme } from '@codedoc/core/transport'; - -import { ActionOverlayStyle } from './style'; - - -export interface ActionOverlayOptions { - title: any; - actions?: any; - close?: Ref<() => void>; -} - - -export function ActionOverlay( - this: ThemedComponentThis, - options: ActionOverlayOptions, - renderer: RendererLike, - content: any, -) { - const classes = this.theme.classes(ActionOverlayStyle); - const holder = ref(); - - this.track({ - bind() { - setTimeout(() => holder.$.classList.add('active'), 10); - if (!('backdropFilter' in holder.$.style) && !('-webkit-backdrop-filter' in holder.$.style)) { - holder.$.style.background = 'rgba(48, 48, 48, .99)'; - } - } - }); - - const close = () => { - holder.$.classList.remove('active'); - setTimeout(() => holder.$.remove(), 300); - }; - - if (options.close) options.close.resolve(close); - - return
{ - const key = (event as KeyboardEvent).key; - if (key === 'Escape') { - event.preventDefault(); - event.stopPropagation(); - close(); - } - }}> -
-
-
{options.title}
-
-
-
- {content} - { - options.actions? - -
-
- {options.actions} -
-
: - '' - } -
-
-
; -} - - diff --git a/.codedoc/components/action-overlay/style.ts b/.codedoc/components/action-overlay/style.ts deleted file mode 100644 index 4222df8..0000000 --- a/.codedoc/components/action-overlay/style.ts +++ /dev/null @@ -1,129 +0,0 @@ -import { themedStyle } from '@connectv/jss-theme'; -import { CodedocTheme } from '@codedoc/core/transport'; - - -export const ActionOverlayStyle = /*#__PURE__*/themedStyle(theme => ({ - overlay: { - zIndex: 1000, - position: 'fixed', - display: 'flex', - justifyContent: 'center', - alignItems: 'center', - top: 0, left: 0, bottom: 0, right: 0, - background: 'rgba(64, 64, 64, .65)', - backdropFilter: 'blur(16px)', - WebkitBackdropFilter: 'blur(16px)', - opacity: 0, - transition: 'opacity .15s', - '&.active': {opacity: 1}, - }, - - content: { - width: 'calc(50vw - 32px)', - height: 'calc(75vh - 32px)', - overflow: 'auto', - padding: 16, - - '@media screen and (max-width: 1200px)': { - width: 'calc(100vw - 64px)', - height: 'calc(100vh - 64px)', - padding: 32, - }, - - color: '#e0e0e0', - - '& input': { - background: 'rgba(64, 64, 64, .15)', - border: '1px solid #ffffff3a', - borderRadius: 8, - padding: 8, - margin: '8px 0', - outline: 'none', - fontSize: 24, - display: 'block', - width: 'calc(100% - 16px)', - flexGrow: 1, - color: 'white', - - '&::placeholder': { - color: 'rgba(255, 255, 255, .25)', - } - }, - - '& button': { - background: 'white', - color: 'black', - fontSize: 'inherit', - fontFamily: 'inherit', - padding: 8, - borderRadius: 3, - cursor: 'pointer', - outline: 'none', - border: '2px solid white', - transition: 'color .15s, background .15s, border-color .15s', - marginBottom: 8, - '&>span': { - marginRight: 16, - }, - - '&:hover': { - color: 'white', - background: 'transparent', - }, - - '&[disabled]': { - background: 'rgba(64, 64, 64, .3)', - borderColor: 'transparent', - color: 'white', - cursor: 'initial', - }, - }, - }, - - top: { - display: 'flex', - alignItems: 'top', - }, - - title: { - flexGrow: 1, - fontSize: 32, - }, - - body: { - position: 'relative' - }, - - actions: { - textAlign: 'right', - '& button': { - marginLeft: 8, - } - }, - - close: { - position: 'relative', - display: 'flex', - justifyContent: 'center', - alignItems: 'center', - cursor: 'pointer', - opacity: .25, - width: 64, - height: 64, - borderRadius: 3, - transition: 'opacity .15s', - '&:hover': {opacity: 1}, - - '&:before, &:after': { - content: '" "', - background: 'white', - borderRadius: 2, - width: 48, - height: 2, - position: 'absolute', - transformOrigin: 'center', - }, - '&:before': { transform: 'rotate(45deg)'}, - '&:after': { transform: 'rotate(-45deg)'}, - }, -})); diff --git a/.codedoc/components/article-preview/defer-bg-images.ts b/.codedoc/components/article-preview/defer-bg-images.ts deleted file mode 100644 index 105567c..0000000 --- a/.codedoc/components/article-preview/defer-bg-images.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { onReady, funcTransport } from '@connectv/sdh/transport'; - - -export function deferBgImages() { - onReady(() => { - const _exec = () => { - document.querySelectorAll('[data-bg-image]').forEach(el$ => { - const _ogStyle = el$.getAttribute('style'); - setTimeout(() => { - el$.setAttribute('style', [ - ...(_ogStyle?[_ogStyle]:[]), - `background-image: url('https://github.com/$%7Bel$.getAttribute('data-bg-image')}')` - ].join(';')); - }, 1); - }); - }; - - _exec(); window.addEventListener('navigation', _exec); - }); -} - -export const deferBgImages$ = /*#__PURE__*/funcTransport(deferBgImages); \ No newline at end of file diff --git a/.codedoc/components/article-preview/index.tsx b/.codedoc/components/article-preview/index.tsx deleted file mode 100644 index ba07cb0..0000000 --- a/.codedoc/components/article-preview/index.tsx +++ /dev/null @@ -1,80 +0,0 @@ -import { ThemedComponentThis } from '@connectv/jss-theme'; -import { CodedocTheme } from '@codedoc/core'; -import { ArticlePreviewStyle } from './style'; -import { Buttons, Button, Icon } from '@codedoc/core/components'; - - -export interface ArticlePreviewOptionsBase { - title: string; - url: string; -} - -export interface ArticlePreviewOptionsWithImage - extends ArticlePreviewOptionsBase { - image: string; - style: 'card' | 'row' | 'row-reverse'; -} - -export interface ArticlePreviewOptionsWithOutImage - extends ArticlePreviewOptionsBase { -} - -export type ArticlePreviewOptions = - ArticlePreviewOptionsWithImage | ArticlePreviewOptionsWithOutImage; - -export function isWithImage(options: ArticlePreviewOptions): - options is ArticlePreviewOptionsWithImage { - return options && (options as any).image; -} - - -export function ArticlePreview( - this: ThemedComponentThis, - options: ArticlePreviewOptions, - renderer: any, - content: any -) { - const classes = this.theme.classes(ArticlePreviewStyle); - let style = 'card'; - if (isWithImage(options) && options.style) style = options.style; - - return
-
- {isWithImage(options)? - - :''} - -
-
-} - - -export interface ArticlePreviewRowOptions { - alignSummary?: 'tiny' | 'short' | 'medium' | 'long' -} - - -export function ArticlePreviewRow( - this: ThemedComponentThis, - options: ArticlePreviewRowOptions, - renderer: any, - content: any -) { - const classes = this.theme.classes(ArticlePreviewStyle); - return
- {content} -
-} - - -export { deferBgImages$ } from './defer-bg-images'; \ No newline at end of file diff --git a/.codedoc/components/article-preview/style.ts b/.codedoc/components/article-preview/style.ts deleted file mode 100644 index abcfffe..0000000 --- a/.codedoc/components/article-preview/style.ts +++ /dev/null @@ -1,123 +0,0 @@ -import { themedStyle } from '@connectv/jss-theme'; -import { CodedocTheme } from '@codedoc/core'; - - -export const ArticlePreviewStyle = themedStyle(theme => ({ - title: { - color: theme.light.text, - fontSize: 24, - textDecoration: 'none !important', - 'body.dark &': { color: theme.dark.text }, - '@media (prefers-color-scheme: dark)': { - 'body:not(.dark-mode-animate) &': { color: theme.dark.text } - } - }, - summary: { - '&>a, & p>a, & ul>a, & ul>li>a': { - color: theme.light.text, - textDecoration: 'none !important', - 'body.dark &': { color: theme.dark.text }, - '@media (prefers-color-scheme: dark)': { - 'body:not(.dark-mode-animate) &': { color: theme.dark.text } - } - } - }, - content: { - display: 'block', - }, - image: { - display: 'block', - width: '100%', - height: 256, - borderRadius: 4, - backgroundRepeat: 'no-repeat', - backgroundPosition: 'center', - backgroundSize: 'cover', - marginBottom: 20, - }, - card: { - display: 'block', - '& hr': { - margin: '32px 64px', - } - }, - inside: { - '$card.row &, $card.row-reverse &': { - display: 'flex', - '& $image': { - width: 256, - flexShrink: 0, - } - }, - '$card.row &': { - flexDirection: 'row', - '& $image': { - marginRight: 24, - marginBottom: 0, - } - }, - '$card.row-reverse &': { - flexDirection: 'row-reverse', - '& $image': { - marginLeft: 24, - marginBottom: 0, - } - }, - '@media (max-width: 768px)': { - '$card.row &, $card.row-reverse &': { - display: 'block', - '& $image': { - width: 'auto !important', - marginRight: '0 !important', - marginLeft: '0 !important', - marginBottom: '20px !important', - }, - } - } - }, - row: { - display: 'flex', - flexDirection: 'row', - - '& $card': { - flexGrow: 1, - width: '100%', - - '&:first-child': { - marginRight: 32 - } - }, - - '&[data-align-summary="tiny"]': { - '& $content': { - height: 172, - } - }, - - '&[data-align-summary="short"]': { - '& $content': { - height: 288, - } - }, - - '&[data-align-summary="medium"]': { - '& $content': { - height: 324, - } - }, - - '&[data-align-summary="long"]': { - '& $content': { - height: 384, - } - }, - - '@media (max-width: 768px)': { - display: 'block', - '& $card:first-child': { - marginRight: 0, - marginBottom: 64, - } - } - } -})); \ No newline at end of file diff --git a/.codedoc/components/big.tsx b/.codedoc/components/big.tsx deleted file mode 100644 index 4f6c79e..0000000 --- a/.codedoc/components/big.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { ThemedComponentThis, themedStyle } from '@connectv/jss-theme'; -import { CodedocTheme } from '@codedoc/core'; - - -export const BigStyle = themedStyle(theme => ({ - big: { - '& *': { - fontSize: 24, - }, - } -})); - -export function Big( - this: ThemedComponentThis, - _: any, - renderer: any, - content: any -) { - const classes = this.theme.classes(BigStyle); - return
{content}
-} \ No newline at end of file diff --git a/.codedoc/components/join-beta/button.tsx b/.codedoc/components/join-beta/button.tsx deleted file mode 100644 index 1aae2ed..0000000 --- a/.codedoc/components/join-beta/button.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { RendererLike } from '@connectv/html'; -import { transport } from '@connectv/sdh/transport'; -import { ThemedComponentThis } from '@connectv/jss-theme'; -import { ButtonStyle } from '@codedoc/core/components'; -import { CodedocTheme } from '@codedoc/core/transport'; - -import { JoinBetaOverlay } from '.'; - - -export function JoinButton( - this: ThemedComponentThis, - _: any, - renderer: RendererLike -) { - const classes = this.theme.classes(ButtonStyle); - return ; -} - - - -export const JoinButton$ = /*#__PURE__*/transport(JoinButton); \ No newline at end of file diff --git a/.codedoc/components/join-beta/index.tsx b/.codedoc/components/join-beta/index.tsx deleted file mode 100644 index 06ee9e9..0000000 --- a/.codedoc/components/join-beta/index.tsx +++ /dev/null @@ -1,72 +0,0 @@ -import { state, map, pack } from '@connectv/core'; -import { RendererLike, ref } from '@connectv/html'; -import { Overlay, Loading } from '@codedoc/core/components'; - -import { ActionOverlay } from '../action-overlay'; - - -const emailRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; - -export function JoinBetaOverlay(_: any, renderer: RendererLike) { - const name = state(''); - const email = state(''); - const valid = state(false); - const loading = state(false); - - pack(name, email).to(map(([name, email]: [string, string]) => { - return name.length > 0 && email.length > 0 && emailRegex.test(email); - })).to(valid); - - const close = ref<() => void>(); - - return !v || l))} - onclick={() => { - if (valid.value) { - loading.value = true; - fetch(`https://tinygraykoala47yq.connect-platform.com/beta-waiting-list` - + `?email=${encodeURIComponent(email.value)}` - + `&name=${encodeURIComponent(name.value)}` - ).then(() => { - loading.value = false; - close.$(); - renderer.render( - - done_all
- Success!
-

- Thanks for joining coding.blog beta waiting list! -

-
- ).on(document.body); - }) - .catch(() => { - loading.value = false; - close.$(); - renderer.render( - - error
- Oops
-

event.stopPropagation()}> - Something went wrong. Please try again in a minute or contact us at - contact@connect-platform.com. -

-
- ).on(document.body); - }); - } - }}> - - {loading.to(map((_: boolean) => _ ? 'Joining ...' : 'Join the Waiting List for Beta'))} - }>

- We will only use this name and email address to reserve - your place on coding.blog 's beta waiting list and inform - you of updates regarding the beta program. -

-
- - -
-} \ No newline at end of file diff --git a/.codedoc/components/join-creator/button.tsx b/.codedoc/components/join-creator/button.tsx deleted file mode 100644 index 5839102..0000000 --- a/.codedoc/components/join-creator/button.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { RendererLike } from '@connectv/html'; -import { transport } from '@connectv/sdh/transport'; -import { ThemedComponentThis } from '@connectv/jss-theme'; -import { ButtonStyle } from '@codedoc/core/components'; -import { CodedocTheme } from '@codedoc/core/transport'; - -import { JoinCreatorOverlay } from '.'; - - -export function JoinCreatorButton( - this: ThemedComponentThis, - _: any, - renderer: RendererLike -) { - const classes = this.theme.classes(ButtonStyle); - return ; -} - - - -export const JoinCreatorButton$ = /*#__PURE__*/transport(JoinCreatorButton); \ No newline at end of file diff --git a/.codedoc/components/join-creator/index.tsx b/.codedoc/components/join-creator/index.tsx deleted file mode 100644 index 769b083..0000000 --- a/.codedoc/components/join-creator/index.tsx +++ /dev/null @@ -1,142 +0,0 @@ -import { state, map, pack, sink, pipe } from '@connectv/core'; -import { debounceTime } from 'rxjs/operators'; -import { RendererLike, ref, ComponentThis } from '@connectv/html'; -import { Overlay, Loading } from '@codedoc/core/components'; - -import { ActionOverlay } from '../action-overlay'; -import { isAvailable } from './is-available'; -import { AccountService } from '../account/account.service'; - - -const emailRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; - -const domainRegex = /^(\w+)\.coding\.blog$/; -const bannedDomains = [ - /^ww[0-9]*\.coding\.blog$/, - /^www[0-9]*\.coding\.blog$/, - /^dns[0-9]*\.coding\.blog$/, - /^connect[0-9]*\.coding\.blog$/, - /^accounts?\.coding\.blog$/, - /^support\.coding\.blog$/, - /^admin(istrator)?\.coding\.blog$/, -]; - -export function JoinCreatorOverlay(this: ComponentThis, _: any, renderer: RendererLike) { - const close = ref<() => void>(); - const domainInput = ref(); - - const domain = state('your.coding.blog'); - const email = state(''); - const valid = state(false); - const loading = state(false); - const checking = state(false); - const available = state(false); - - pack(available, email).to(map(([available, email]: [boolean, string]) => { - return emailRegex.test(email) && available; - })).to(valid); - - const postfix = domain.to(sink(() => { - const match = /^(.+)?\.coding\.blog(.+)?$/.exec(domain.value) || []; - const not = /[^\w|\-]/ - const name = (match[1] || '').toLowerCase().split(not).join('') + - (match[2] || '').toLowerCase().split(not).join(''); - domain.value = name + '.coding.blog'; - if ((domainInput.$.selectionStart || 0) > name.length || (domainInput.$.selectionEnd || 0) > name.length) - domainInput.$.setSelectionRange(name.length, name.length); - })); - - domain - .to(sink(() => available.value = false)) - .to(sink(() => checking.value = true)) - .to(pipe(debounceTime(1000))) - .to(map((domain: string, done) => isAvailable(domain).then(done))) - .to(sink(() => checking.value = false)) - .to(map((x: boolean) => x - && domainRegex.test(domain.value) - && bannedDomains.every(d => !d.test(domain.value)) - )) - .to(available); - - this.track({ - bind() { - setTimeout(() => { - if (AccountService.instance().data.value) { - email.value = AccountService.instance().data.value?.email || ''; - } - }, 10); - }, - - clear() { - postfix.clear(); - } - }); - - return !v || l))} - onclick={() => { - if (valid.value) { - loading.value = true; - fetch(`https://tinygraykoala47yq.connect-platform.com/prospective-creator-list` - + `?domain=${encodeURIComponent(domain.value.toLowerCase())}` - + `&email=${encodeURIComponent(email.value)}` - ).then(() => { - loading.value = false; - close.$(); - renderer.render( - - done_all
- Success!
-

- Thanks for joining coding.blog prospective creators list! -

-
- ).on(document.body); - }) - .catch(() => { - loading.value = false; - close.$(); - renderer.render( - - error
- Oops
-

event.stopPropagation()}> - Something went wrong. Please try again in a minute or contact us at - contact@connect-platform.com. -

-
- ).on(document.body); - }); - } - }}> - - {loading.to(map((_: boolean) => _ ? 'Joining ...' : 'Join the Prospective Creators List'))} - - }> -

- We will use this email to contact you regarding your chosen domain - name and how you can connect it to your blog's git repository, alongside - updating you on `coding.blog`'s status and roadmap. -

-
- -
- - -
-} \ No newline at end of file diff --git a/.codedoc/components/join-creator/is-available.ts b/.codedoc/components/join-creator/is-available.ts deleted file mode 100644 index fbc21e0..0000000 --- a/.codedoc/components/join-creator/is-available.ts +++ /dev/null @@ -1,18 +0,0 @@ -import Airtable from 'airtable'; - - -const list = new Airtable({ apiKey: 'keyQGj55fyhHaDFwL' }).base('appiGf2nOevW1GDnA')('Prospective Creators'); - -export function isAvailable(domain: string) { - return new Promise(resolve => { - list.select({ - filterByFormula: `{domain name}='${domain.toLowerCase()}'` - }) - .firstPage() - .then(res => { - if (res.length > 0) resolve(false); - else resolve(true); - }) - .catch(() => resolve(false)); - }); -} diff --git a/.codedoc/components/person-card/index.tsx b/.codedoc/components/person-card/index.tsx deleted file mode 100644 index 43dc088..0000000 --- a/.codedoc/components/person-card/index.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { CodedocTheme } from '@codedoc/core/transport'; -import { ThemedComponentThis } from '@connectv/jss-theme'; - -import { PersonCardStyle } from './style'; - - -export interface PersonCardOptions { - name: string; - avatar: string; - subtitle?: string; -} - - -export function PersonCard( - this: ThemedComponentThis, - options: PersonCardOptions, - renderer: any, - content: any -) { - const classes = this.theme.classes(PersonCardStyle); - return
-
- -
-
{options.name}
-
{options.subtitle || ''}
-
-
-
- {content} -
-
-} diff --git a/.codedoc/components/person-card/style.ts b/.codedoc/components/person-card/style.ts deleted file mode 100644 index 8236d3b..0000000 --- a/.codedoc/components/person-card/style.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { themedStyle } from '@connectv/jss-theme'; -import { CodedocTheme } from '@codedoc/core/transport'; - - -export const PersonCardStyle = /*#__PURE__*/themedStyle(theme => ({ - card: { - padding: 16, - overflow: 'hidden', - }, - avatar: { - width: 56, - height: 56, - marginRight: 8, - borderRadius: 96, - }, - top: { - display: 'flex', - }, - toptext: { - flexGrow: 1, - }, - title: { - fontSize: 24, - }, - subtitle: { - fontSize: 10, - opacity: .5, - }, - content: { - - }, -})); \ No newline at end of file diff --git a/.codedoc/config.ts b/.codedoc/config.ts deleted file mode 100644 index 8842634..0000000 --- a/.codedoc/config.ts +++ /dev/null @@ -1,116 +0,0 @@ -import { - configuration, - DefaultConfig, - DefaultMarkdownCustomInlineComponents, - DefaultMarkdownCustomComponents, -} from '@codedoc/core'; - -import { Loading, formulaPlugin } from '@codedoc/core/components'; - -import { theme } from './theme'; -import { Big } from './components/big'; -import { PersonCard } from './components/person-card'; -import { JoinButton$ } from './components/join-beta/button'; -import { JoinCreatorButton$ } from './components/join-creator/button'; - -import { LogoutButton$ } from './components/account/logout'; -import { LoginButton$ } from './components/account/login'; -import { AccountStatusBound } from './components/account/status-bound'; -import { AccountPropBound } from './components/account/prop-bound'; -import { - AccountProp$, - AccountPropCode$, -} from './components/account/account-prop'; -import { EditNameButton$ } from './components/account/edit-name'; -import { BindRepoButton$ } from './components/account/bind-repo'; -import { - PublishButton$, - RefreshPublishWebhookButton$, -} from './components/account/publish-blog'; -import { PublishStatus$ } from './components/account/publish-status'; -import { - ArticlePreview, - ArticlePreviewRow, - deferBgImages$, -} from './components/article-preview'; - -import { googleAnalytics } from './plugins/ga'; - -export const config = /*#__PURE__*/ configuration({ - theme, - dev: { - port: 3000, - }, - page: { - title: { - base: 'coding.blog', - }, - scripts: [], - favicon: '/favicon.ico', - meta: { - subject: 'A Blog for Everything Coding', - description: - 'An open-source blog system for coding and coders. No content-marketing, no ads in disguise. Pure quality articles.', - keywords: [ - 'blog', - 'article', - 'software', - 'programming', - 'code', - 'open-source', - 'open source', - 'coding', - 'tech', - 'IT', - 'blogging', - 'tutorials', - 'articles', - 'convenient', - 'beautiful', - 'modern', - ], - }, - }, - dest: { - html: 'dist', - assets: 'dist', - }, - bundle: { - init: [...DefaultConfig.bundle.init, deferBgImages$], - }, - plugins: [formulaPlugin, googleAnalytics('UA-177467962-1')], - markdown: { - customInlineComponents: { - ...DefaultMarkdownCustomInlineComponents, - Loading, - AccountProp: AccountProp$, - }, - customComponents: { - ...DefaultMarkdownCustomComponents, - Big, - PersonCard, - JoinButton: JoinButton$, - JoinCreatorButton: JoinCreatorButton$, - - LogoutButton: LogoutButton$, - LoginButton: LoginButton$, - AccountStatusBound, - AccountPropBound, - AccountProp: AccountPropCode$, - EditNameButton: EditNameButton$, - BindRepoButton: BindRepoButton$, - PublishButton: PublishButton$, - RefreshPublishWebhookButton: RefreshPublishWebhookButton$, - PublishStatus: PublishStatus$, - - ArticlePreview, - ArticlePreviewRow, - }, - }, - misc: { - github: { - user: 'CONNECT-platform', - repo: 'coding-blog', - }, - }, -}); diff --git a/.codedoc/content/footer.tsx b/.codedoc/content/footer.tsx deleted file mode 100644 index e98956b..0000000 --- a/.codedoc/content/footer.tsx +++ /dev/null @@ -1,69 +0,0 @@ -import { CodedocConfig, CodedocTheme } from '@codedoc/core'; -import { Footer as _Footer } from '@codedoc/core/components'; -import { themedStyle, ThemedComponentThis } from '@connectv/jss-theme'; - - -const style = themedStyle(() => ({ - imgLink: { - position: 'relative', - width: 24, - height: 24, - margin: '0 12px', - opacity: .25, - transition: 'opacity .1s !important', - '&:hover': { opacity: 1, }, - - '& img': { - position: 'absolute', - width: '100%', - height: '100%', - top: 0, - left: 0, - transition: 'opacity .3s', - - '&.light': { - 'body.dark &': { - opacity: 0, - }, - - '@media (prefers-color-scheme: dark)': { - 'body:not(.dark-mode-animate) &': { - opacity: 0 - } - }, - }, - - '&.dark': { - opacity: 0, - 'body.dark &': { - opacity: 1, - }, - - '@media (prefers-color-scheme: dark)': { - 'body:not(.dark-mode-animate) &': { - opacity: 1 - } - }, - }, - } - } -})); - - -export function Footer(this: ThemedComponentThis, config: CodedocConfig, renderer: any) { - const classes = this.theme.classes(style); - return <_Footer> - - - - - - - - - - - - - ; -} diff --git a/.codedoc/content/header.tsx b/.codedoc/content/header.tsx deleted file mode 100644 index 11060dd..0000000 --- a/.codedoc/content/header.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { CodedocConfig } from '@codedoc/core'; -import { Header as _Header, Watermark } from '@codedoc/core/components'; - - -export function Header(_: CodedocConfig, renderer: any) { - return ( - <_Header> - ) -} diff --git a/.codedoc/content/index.tsx b/.codedoc/content/index.tsx deleted file mode 100644 index 934fb6e..0000000 --- a/.codedoc/content/index.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { RendererLike } from '@connectv/html'; -import { File } from 'rxline/fs'; -import { Page, Meta, ContentNav, Fonts, ToC, GithubSearch$ } from '@codedoc/core/components'; - -import { config } from '../config'; -import { Header } from './header'; -import { Footer } from './footer'; - - -export function content(_content: HTMLElement, toc: HTMLElement, renderer: RendererLike, file: File) { - return ( - } - fonts={} - - scripts={config.page.scripts} - stylesheets={config.page.stylesheets} - - header={
} - footer={