-
-
Notifications
You must be signed in to change notification settings - Fork 586
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
no more postinstall because it is bugguy in the meta-repo now commit …
…dist/
- Loading branch information
Showing
102 changed files
with
12,515 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,5 @@ node_modules | |
.vscode | ||
.git | ||
old | ||
dist/ | ||
silex/ | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import { ConnectorId, JobId, PublicationJobData, WebsiteId, ConnectorData, ConnectorType, WebsiteData, ClientSideFile, PublicationData, ConnectorUser, WebsiteMeta, WebsiteMetaFileContent, ConnectorOptions } from '../types'; | ||
export declare enum ApiRoute { | ||
PUBLICATION_PUBLISH = "/api/publication/", | ||
PUBLICATION_STATUS = "/api/publication/publication/status", | ||
CONNECTOR_USER = "/api/connector/user", | ||
CONNECTOR_LOGOUT = "/api/connector/logout", | ||
CONNECTOR_LIST = "/api/connector/", | ||
WEBSITE_READ = "/api/website/", | ||
WEBSITE_WRITE = "/api/website/", | ||
WEBSITE_DELETE = "/api/website/", | ||
WEBSITE_DUPLICATE = "/api/website/duplicate", | ||
WEBSITE_CREATE = "/api/website/", | ||
WEBSITE_LIST = "/api/website/", | ||
WEBSITE_ASSETS_READ = "/api/website/assets", | ||
WEBSITE_ASSETS_WRITE = "/api/website/assets", | ||
WEBSITE_META_READ = "/api/website/meta", | ||
WEBSITE_META_WRITE = "/api/website/meta" | ||
} | ||
export declare function setServerUrl(url: string): void; | ||
export declare function getServerUrl(): string; | ||
export declare function getUser({ type, connectorId }: { | ||
type: ConnectorType; | ||
connectorId?: ConnectorId; | ||
}): Promise<ConnectorUser>; | ||
export declare function logout({ type, connectorId }: { | ||
type: ConnectorType; | ||
connectorId?: ConnectorId; | ||
}): Promise<void>; | ||
export declare function publish({ websiteId, hostingId, storageId, data, options }: { | ||
websiteId: WebsiteId; | ||
hostingId: ConnectorId; | ||
storageId: ConnectorId; | ||
data: PublicationData; | ||
options: ConnectorOptions; | ||
}): Promise<[url: string, job: PublicationJobData]>; | ||
export declare function publicationStatus({ jobId }: { | ||
jobId: JobId; | ||
}): Promise<PublicationJobData>; | ||
export declare function connectorList({ type }: { | ||
type: ConnectorType; | ||
}): Promise<ConnectorData[]>; | ||
export declare function websiteList({ connectorId }: { | ||
connectorId?: ConnectorId; | ||
}): Promise<WebsiteMeta[]>; | ||
export declare function websiteLoad({ websiteId, connectorId }: { | ||
websiteId: WebsiteId; | ||
connectorId?: ConnectorId; | ||
}): Promise<WebsiteData>; | ||
export declare function websiteSave({ websiteId, data, connectorId }: { | ||
websiteId: WebsiteId; | ||
data: WebsiteData; | ||
connectorId?: ConnectorId; | ||
}): Promise<void>; | ||
export declare function websiteDelete({ websiteId, connectorId }: { | ||
websiteId: WebsiteId; | ||
connectorId?: ConnectorId; | ||
}): Promise<void>; | ||
export declare function websiteDuplicate({ websiteId, connectorId }: { | ||
websiteId: WebsiteId; | ||
connectorId?: ConnectorId; | ||
}): Promise<void>; | ||
export declare function websiteCreate({ websiteId, data, connectorId }: { | ||
websiteId: WebsiteId; | ||
data: WebsiteMetaFileContent; | ||
connectorId?: ConnectorId; | ||
}): Promise<void>; | ||
export declare function websiteMetaWrite({ websiteId, data, connectorId }: { | ||
websiteId: WebsiteId; | ||
data: WebsiteMetaFileContent; | ||
connectorId?: ConnectorId; | ||
}): Promise<void>; | ||
export declare function websiteMetaRead({ websiteId, connectorId }: { | ||
websiteId: WebsiteId; | ||
connectorId?: ConnectorId; | ||
}): Promise<WebsiteMeta>; | ||
export declare function websiteAssetsLoad({ path, websiteId, connectorId }: { | ||
path: string; | ||
websiteId: WebsiteId; | ||
connectorId: ConnectorId; | ||
}): Promise<string>; | ||
/** | ||
* Not used directly, grapesjs handles the upload | ||
* @see assetManager in src/ts/client/grapesjs/index.ts | ||
*/ | ||
export declare function websiteAssetsSave({ websiteId, connectorId, files }: { | ||
websiteId: WebsiteId; | ||
connectorId: ConnectorId; | ||
files: ClientSideFile[]; | ||
}): Promise<string[]>; | ||
export declare function api<ReqQuery, ReqBody, ResBody>(route: ApiRoute | string, method: string, query?: ReqQuery, payload?: ReqBody): Promise<ResBody>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { Asset, ClientSideFileType, ConnectorId, Page, Style, WebsiteId } from '../types'; | ||
/** | ||
* Function to convert a path from it stored version to the displayed version | ||
* Stored version is like `/assets/image.webp` | ||
* Grapesjs version is like `/api/website/assets/image.webp?websiteId=47868975&connectorId=gitlab` | ||
* Exported for unit tests | ||
*/ | ||
export declare function storedToDisplayed(path: string, websiteId: WebsiteId, storageId: ConnectorId): string; | ||
/** | ||
* Function to convert a path from the one we give to grapesjs to the stored version | ||
* Grapesjs version is like `/api/website/assets/image.webp?websiteId=47868975&connectorId=gitlab` | ||
* Stored version is like `/assets/image.webp` | ||
* @param path the path to convert | ||
* @returns the converted path | ||
* Exported for unit tests | ||
*/ | ||
export declare function displayedToStored(path: string): string; | ||
/** | ||
* Publication transformer to convert the asset URL during publication | ||
*/ | ||
export declare const assetsPublicationTransformer: { | ||
transformPath(path: string, type: ClientSideFileType): string; | ||
transformPermalink(path: string, type: ClientSideFileType): string; | ||
}; | ||
/** | ||
* Update asset URL to use the current storage connector and website ID | ||
* Assets URLs are stored in the project data in the form `/assets/image.webp` | ||
* This function adds the API path and the connectorId and websiteId like so: `/api/website/assets/image.webp?websiteId=47868975&connectorId=gitlab` | ||
*/ | ||
export declare function addTempDataToAssetUrl(assets: Asset[], websiteId: WebsiteId, storageId: ConnectorId): Asset[]; | ||
/** | ||
* Remove the temporary data from the asset URL | ||
* Remove the API path and the connectorId and websiteId like so: `/assets/image.webp` | ||
*/ | ||
export declare function removeTempDataFromAssetUrl(assets: Asset[]): Asset[]; | ||
/** | ||
* Add temp data to pages | ||
*/ | ||
export declare function addTempDataToPages(pages: Page[], websiteId: WebsiteId, storageId: ConnectorId): Page[]; | ||
/** | ||
* Remove temp data from asset URL in the components | ||
*/ | ||
export declare function removeTempDataFromPages(pages: Page[]): Page[]; | ||
/** | ||
* Add data to stylesheets | ||
* e.g. linear-gradient(to right, #1fb101 0%, #df1313 67%, rgba(234, 97, 97, 255) 78%, white 100%), url('/assets/qIg7JPRc.webp'), linear-gradient(#0ca311 0%, #0ca311 100%) | ||
*/ | ||
export declare function addTempDataToStyles(styles: Style[], websiteId: WebsiteId, storageId: ConnectorId): Style[]; | ||
/** | ||
* Remove temp data from stylesheets | ||
* The property `background-image` contains the URLs of the assets and other values, | ||
* e.g. `linear-gradient(to right, #1fb101 0%, #df1313 67%, rgba(234, 97, 97, 255) 78%, white 100%), url('/api/website/assets/qIg7JPRc.webp?websiteId=default&connectorId=fs-storage'), linear-gradient(#0ca311 0%, #0ca311 100%)` | ||
*/ | ||
export declare function removeTempDataFromStyles(styles: Style[]): Style[]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import { Config } from '@silexlabs/silex-plugins'; | ||
import { ConnectorId, WebsiteId } from '../types'; | ||
import { Editor, EditorConfig } from 'grapesjs'; | ||
import { PublicationTransformer } from './publication-transformers'; | ||
import * as api from './api'; | ||
import { SettingsSection } from './grapesjs/settings-sections'; | ||
/** | ||
* @fileoverview Silex client side config | ||
*/ | ||
export declare class ClientConfig extends Config { | ||
api: typeof api; | ||
/** | ||
* The website to load | ||
* This is the id of the website in the storage connector | ||
*/ | ||
websiteId: WebsiteId; | ||
/** | ||
* The storage connector to use | ||
* If not found in the URL and the user is not logged in to any storage, use the first storage | ||
*/ | ||
storageId: ConnectorId; | ||
/** | ||
* language for I18n module | ||
*/ | ||
lang: string; | ||
/** | ||
* root url of Silex app | ||
*/ | ||
rootUrl: string; | ||
/** | ||
* debug mode | ||
*/ | ||
debug: boolean; | ||
/** | ||
* Add hash in the file name of CSS at the time of publication | ||
* If true, CSS files of generated pages will look like `page-name.123456.css` instead of `page-name.css` | ||
* This is useful to avoid caching issues | ||
* @default true | ||
*/ | ||
addHashInCssFileName: boolean; | ||
/** | ||
* Replaced elements | ||
* This is a list of elements which support the object-fit and object-position CSS properties | ||
* https://developer.mozilla.org/en-US/docs/Web/CSS/Replaced_element | ||
* When selected, Silex will show the object-fit and object-position properties in the style panel | ||
*/ | ||
replacedElements: string[]; | ||
/** | ||
* Grapesjs config | ||
*/ | ||
grapesJsConfig: EditorConfig; | ||
/** | ||
* Client config url | ||
* This is the url of the config file which is a plugin | ||
*/ | ||
clientConfigUrl: string; | ||
/** | ||
* Google fonts API key, see this doc to get an API key: https://developers.google.com/fonts/docs/developer_api#APIKey | ||
* @default Test key for local dev | ||
*/ | ||
fontsApiKey: string; | ||
/** | ||
* Google fonts server or a free privacy-friendly drop-in replacement for Google Fonts or a proxy server to speed up the load and protect privacy | ||
* @see https://github.com/coollabsio/fonts | ||
* @see https://fontlay.com/ | ||
* @default Google Fonts | ||
*/ | ||
fontsServerUrl: string; | ||
fontsApiUrl: string; | ||
/** | ||
* Init GrapesJS config which depend on the config file properties | ||
*/ | ||
initGrapesConfig(): void; | ||
/** | ||
* Get grapesjs editor | ||
*/ | ||
getEditor(): Editor; | ||
/** | ||
* Publication transformers let plugins change files before they are published | ||
*/ | ||
publicationTransformers: Array<PublicationTransformer>; | ||
/** | ||
* Reset publication transformers | ||
*/ | ||
resetPublicationTransformers(): void; | ||
/** | ||
* Add a publication transformer(s) | ||
*/ | ||
addPublicationTransformers(transformers: PublicationTransformer | PublicationTransformer[]): void; | ||
/** | ||
* Add a section to the settings dialog | ||
*/ | ||
addSettings(section: SettingsSection, siteOrPage: 'site' | 'page', position?: 'first' | 'last' | number): void; | ||
/** | ||
* Remove a section from the settings dialog | ||
*/ | ||
removeSettings(id: string, siteOrPage: 'site' | 'page'): void; | ||
/** | ||
* Add default plugins | ||
*/ | ||
addDefaultPlugins(): Promise<void>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
export declare enum ClientEvent { | ||
STARTUP_START = "silex:startup:start",/* Loading is over and Silex is starting */ | ||
STARTUP_END = "silex:startup:end",/* Silex is ready to be used */ | ||
GRAPESJS_START = "silex:grapesjs:start",/* GrapesJS is about to be initialized, it is time to edit config.grapesJsConfig */ | ||
GRAPESJS_END = "silex:grapesjs:end",/* GrapesJS is ready to be used, `editor` is passed as an argument */ | ||
PUBLICATION_UI_OPEN = "silex:publication-ui:open",/* The publication UI is opened, you can access it with { publicationUi } */ | ||
PUBLICATION_UI_CLOSE = "silex:publication-ui:close",/* The publication UI is closed, you can access it with { publicationUi } */ | ||
PUBLISH_BEFORE = "silex:publish:before",/* Publication is about to start, you can read+write {projectData, siteSettings} */ | ||
PUBLISH_START = "silex:publish:start",/* Publication starts, you can read+write project data/settings, use publication manager/ui, prevent publication {projectData, siteSettings, publicationManager, prenventDefault} */ | ||
PUBLISH_PAGE = "silex:publish:page",/* Publication of a page, read+write settings and page data, use publication manager and prevent publication { siteSettings, pageSettings, page, publicationManager, preventDefault } */ | ||
PUBLISH_DATA = "silex:publish:data",/* Just before we send the published data to the server, read+write all publication data, check PublicationData type in types.ts { data, publicationManager } */ | ||
PUBLISH_END = "silex:publish:end",/* Publication is over, the argument is the publication result with {success: boolean, message: string} */ | ||
PUBLISH_ERROR = "silex:publish:error",/* Publication failed, the argument is the publication result with {success: boolean, message: string} */ | ||
PUBLISH_LOGIN_START = "silex:publish:login:start",/* The user is about to login before publication, you can read+write connector data and use publication manager and prevent publication {connector, publicationManager, preventDefault} */ | ||
PUBLISH_LOGIN_END = "silex:publish:login:end", | ||
ASSET_WRITE_END = "silex:asset:write:end", | ||
WRITE_END = "silex:write:end", | ||
SETTINGS_OPEN = "silex:settings:open",/* The settings dialog is opened */ | ||
SETTINGS_CLOSE = "silex:settings:close",/* The settings dialog is closed */ | ||
SETTINGS_SAVE_START = "silex:settings:save:start",/* The settings dialog is closed and the settings are about to be saved */ | ||
SETTINGS_SAVE_END = "silex:settings:save:end",/* The settings dialog is closed and the settings are saved */ | ||
SETTINGS_SECTION_CHANGE = "silex:settings:section-change" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export * from './grapesjs/index'; | ||
export * from './config'; | ||
export * as constants from '../constants'; | ||
export * as utils from './utils'; | ||
export * as api from './api'; | ||
export * as events from './events'; | ||
export * as page from '../page'; | ||
export * as types from '../types'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Editor } from 'grapesjs'; | ||
import { ConnectorId, ConnectorType, ConnectorUser } from '../../types'; | ||
import { WebsiteId } from '../../types'; | ||
export declare const cmdLogin = "silex:auth:login"; | ||
export declare const cmdLogout = "silex:auth:logout"; | ||
export declare const eventLoggingIn = "silex:auth:logging-in"; | ||
export declare const eventLoggedIn = "silex:auth:logged-in"; | ||
export declare const eventLoginFailed = "silex:auth:login-failed"; | ||
export declare const eventLoggedOut = "silex:auth:logged-out"; | ||
export interface LoginDialogOptions { | ||
id: WebsiteId; | ||
} | ||
export declare function getCurrentUser(editor: Editor): Promise<ConnectorUser>; | ||
export declare function updateUser(editor: Editor, type: ConnectorType, connectorId?: ConnectorId): Promise<ConnectorUser>; | ||
export default function loginDialogPlugin(editor: any, opts: any): void; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import { ConnectorData, PublicationData, PublicationJobData, PublicationSettings, WebsiteFile, WebsiteId, WebsiteSettings } from '../../types'; | ||
import { Editor } from 'grapesjs'; | ||
import { PublicationUi } from './PublicationUi'; | ||
/** | ||
* @fileoverview Publication manager for Silex | ||
* This plugin adds a publication feature to Silex | ||
* It lets the user publish the website to a hosting service | ||
* It can optionally display a button and a dialog | ||
* Useful commands: | ||
* - publish: starts the publication process and optionally open the dialog | ||
* - publish-login: open the login dialog | ||
* - publish-logout: logout from the hosting service and let the user choose a hosting service again | ||
*/ | ||
export declare const cmdPublicationStart = "publish"; | ||
export declare const cmdPublicationLogin = "publish-login"; | ||
export declare const cmdPublicationLogout = "publish-logout"; | ||
export type PublishableEditor = Editor & { | ||
PublicationManager: PublicationManager; | ||
}; | ||
export declare enum PublicationStatus { | ||
STATUS_NONE = "STATUS_NONE", | ||
STATUS_PENDING = "STATUS_PENDING", | ||
STATUS_ERROR = "STATUS_ERROR", | ||
STATUS_SUCCESS = "STATUS_SUCCESS", | ||
STATUS_LOGGED_OUT = "STATUS_AUTH_ERROR" | ||
} | ||
export type PublicationManagerOptions = { | ||
appendTo?: string; | ||
websiteId: WebsiteId; | ||
}; | ||
export default function publishPlugin(editor: any, opts: any): void; | ||
export declare class PublicationManager { | ||
private editor; | ||
/** | ||
* Publication dialog | ||
* This class is responsible for the UI | ||
*/ | ||
dialog?: PublicationUi; | ||
/** | ||
* Publication settings | ||
* This is the data which is stored in the website settings | ||
*/ | ||
_settings: PublicationSettings; | ||
get settings(): PublicationSettings; | ||
set settings(newSettings: PublicationSettings); | ||
/** | ||
* Plugin options | ||
* This is the data which is passed to the plugin by grapesjs | ||
*/ | ||
options: PublicationManagerOptions; | ||
/** | ||
* Publication job during the publication process | ||
*/ | ||
job: PublicationJobData | null; | ||
/** | ||
* Publication state | ||
* This is the state of the publication process | ||
*/ | ||
status: PublicationStatus; | ||
constructor(editor: PublishableEditor, opts: PublicationManagerOptions); | ||
goLogin(connector: ConnectorData): Promise<void>; | ||
goLogout(): Promise<void>; | ||
getPublicationData(projectData: any, siteSettings: any, preventDefault: () => void): Promise<PublicationData>; | ||
/** | ||
* Start the publication process | ||
* This is the command "publish" | ||
*/ | ||
startPublication(): Promise<void>; | ||
getHtmlFiles(siteSettings: WebsiteSettings, preventDefault: any): Promise<WebsiteFile[]>; | ||
trackProgress(): Promise<void>; | ||
private setPublicationTransformers; | ||
private resetPublicationTransformers; | ||
} |
Oops, something went wrong.