Astro+Directus(Visual-Editing)+Snipcart Test-Stack
This commit is contained in:
+89
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
+50
@@ -0,0 +1,50 @@
|
||||
//#region src/lib/types/directus.d.ts
|
||||
/** These types are shared with Directus */
|
||||
/** Keep in sync with Directus */
|
||||
type PrimaryKey = string | number;
|
||||
type EditConfig$1 = {
|
||||
collection: string;
|
||||
item: PrimaryKey | null;
|
||||
fields?: string[];
|
||||
mode?: 'drawer' | 'modal' | 'popover';
|
||||
};
|
||||
type SavedData$1 = {
|
||||
key: string;
|
||||
collection: EditConfig$1['collection'];
|
||||
item: EditConfig$1['item'];
|
||||
payload: Record<string, unknown>;
|
||||
};
|
||||
//#endregion
|
||||
//#region src/lib/types/index.d.ts
|
||||
type EditConfigStrict = EditConfig$1;
|
||||
type EditConfig = Omit<EditConfigStrict, 'fields'> & {
|
||||
fields?: EditConfigStrict['fields'] | string;
|
||||
};
|
||||
type SavedData = SavedData$1;
|
||||
type EditableElementOptions = {
|
||||
customClass?: string | undefined;
|
||||
onSaved?: ((data: Omit<SavedData, 'key'>) => void) | undefined;
|
||||
};
|
||||
//#endregion
|
||||
//#region src/index.d.ts
|
||||
declare function apply({
|
||||
directusUrl,
|
||||
elements,
|
||||
customClass,
|
||||
onSaved
|
||||
}: {
|
||||
directusUrl: string;
|
||||
elements?: HTMLElement | HTMLElement[] | null;
|
||||
} & EditableElementOptions): Promise<{
|
||||
remove(): void;
|
||||
enable(): void;
|
||||
disable(): void;
|
||||
} | undefined>;
|
||||
declare function remove(): void;
|
||||
declare function disable(): {
|
||||
enable(): void;
|
||||
};
|
||||
declare function setAttr(editConfig: EditConfig): string;
|
||||
//#endregion
|
||||
export { apply, disable, remove, setAttr };
|
||||
//# sourceMappingURL=index.d.cts.map
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
//#region src/lib/types/directus.d.ts
|
||||
/** These types are shared with Directus */
|
||||
/** Keep in sync with Directus */
|
||||
type PrimaryKey = string | number;
|
||||
type EditConfig$1 = {
|
||||
collection: string;
|
||||
item: PrimaryKey | null;
|
||||
fields?: string[];
|
||||
mode?: 'drawer' | 'modal' | 'popover';
|
||||
};
|
||||
type SavedData$1 = {
|
||||
key: string;
|
||||
collection: EditConfig$1['collection'];
|
||||
item: EditConfig$1['item'];
|
||||
payload: Record<string, unknown>;
|
||||
};
|
||||
//#endregion
|
||||
//#region src/lib/types/index.d.ts
|
||||
type EditConfigStrict = EditConfig$1;
|
||||
type EditConfig = Omit<EditConfigStrict, 'fields'> & {
|
||||
fields?: EditConfigStrict['fields'] | string;
|
||||
};
|
||||
type SavedData = SavedData$1;
|
||||
type EditableElementOptions = {
|
||||
customClass?: string | undefined;
|
||||
onSaved?: ((data: Omit<SavedData, 'key'>) => void) | undefined;
|
||||
};
|
||||
//#endregion
|
||||
//#region src/index.d.ts
|
||||
declare function apply({
|
||||
directusUrl,
|
||||
elements,
|
||||
customClass,
|
||||
onSaved
|
||||
}: {
|
||||
directusUrl: string;
|
||||
elements?: HTMLElement | HTMLElement[] | null;
|
||||
} & EditableElementOptions): Promise<{
|
||||
remove(): void;
|
||||
enable(): void;
|
||||
disable(): void;
|
||||
} | undefined>;
|
||||
declare function remove(): void;
|
||||
declare function disable(): {
|
||||
enable(): void;
|
||||
};
|
||||
declare function setAttr(editConfig: EditConfig): string;
|
||||
//#endregion
|
||||
export { apply, disable, remove, setAttr };
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
+89
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
+89
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
+16
@@ -0,0 +1,16 @@
|
||||
MIT License
|
||||
|
||||
Copyright 2025 Monospace, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
||||
documentation files (the “Software”), to deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
||||
Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
{
|
||||
"name": "@directus/visual-editing",
|
||||
"version": "1.2.0",
|
||||
"description": "Visual editing library to enable in-place editing of your website’s frontend from within the Visual Editor in Directus",
|
||||
"homepage": "https://directus.io/docs/guides/content/visual-editor",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/directus/visual-editing.git"
|
||||
},
|
||||
"funding": "https://github.com/directus/directus?sponsor=1",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"visual-editing",
|
||||
"visual-editor",
|
||||
"content-editing-experience",
|
||||
"in-place-editing",
|
||||
"in-place-editor",
|
||||
"frontend-editing",
|
||||
"frontend-editor",
|
||||
"content-editing",
|
||||
"content-editor",
|
||||
"live-editing",
|
||||
"live-editor",
|
||||
"directus",
|
||||
"in-place",
|
||||
"frontend",
|
||||
"overlays",
|
||||
"preview",
|
||||
"editing",
|
||||
"editor",
|
||||
"iframe",
|
||||
"cms"
|
||||
],
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./dist/index.js",
|
||||
"require": "./dist/index.cjs",
|
||||
"default": "./dist/visual-editing.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"main": "./dist/index.js",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"@reach/observe-rect": "1.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@directus/tsconfig": "3.0.0",
|
||||
"@eslint/js": "9.39.2",
|
||||
"eslint": "9.39.2",
|
||||
"eslint-config-prettier": "10.1.8",
|
||||
"eslint-plugin-vue": "10.7.0",
|
||||
"globals": "17.3.0",
|
||||
"prettier": "3.8.1",
|
||||
"tsdown": "0.20.1",
|
||||
"typescript": "5.9.3",
|
||||
"typescript-eslint": "8.54.0",
|
||||
"vitest": "4.0.18",
|
||||
"vue-eslint-parser": "10.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=22.12.0"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "NODE_ENV=development tsdown",
|
||||
"build": "NODE_ENV=production tsdown",
|
||||
"test": "vitest --typecheck --watch=false"
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
# Visual Editing Frontend Library by Directus
|
||||
|
||||
This library works together with a Directus instance to enable Visual Editing functionality from within the Visual
|
||||
Editor module in Directus Studio.
|
||||
|
||||
Web developers must make use of this library to ensure communication between their website’s HTML elements and their
|
||||
Directus instance. This is done through data attributes and helper functions built into the library and imported into
|
||||
your website.
|
||||
|
||||
## Documentation
|
||||
|
||||
Documentation covering the setup and functionality for both the frontend library and the studio module can be found in
|
||||
the [Directus documentation](https://directus.io/docs/guides/content/visual-editor).
|
||||
|
||||
## Test Website
|
||||
|
||||
A test website pre-configured to work with the Directus Visual Editor module is included in the library’s repository.
|
||||
This can be used for example purposes and to make it easy to set up an environment for testing or contributing.
|
||||
|
||||
For detailed instructions on setting up the test environment see the
|
||||
[test website's readme.md](https://github.com/directus/visual-editing/blob/main/test-website/readme.md).
|
||||
|
||||
## License
|
||||
|
||||
This package is licensed under the MIT License. See the LICENSE file for more information.
|
||||
|
||||
## Additional Resources
|
||||
|
||||
- [Directus Website](https://directus.io)
|
||||
- [Directus GitHub Repository](https://github.com/directus/directus)
|
||||
Reference in New Issue
Block a user