@blockslides/extension-slide 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md ADDED
@@ -0,0 +1,36 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 BlockSlides
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ---
24
+
25
+ ## Acknowledgments
26
+
27
+ This project includes code and patterns adapted from [Tiptap](https://tiptap.dev),
28
+ an open-source headless editor framework for web artisans.
29
+
30
+ **Tiptap License:**
31
+
32
+ - Copyright (c) 2025, Tiptap GmbH
33
+ - Licensed under MIT License
34
+ - Original source: https://github.com/ueberdosis/tiptap
35
+
36
+ See `_tiptap/LICENSE.md` for the full Tiptap license.
@@ -0,0 +1,22 @@
1
+ import { Node } from '@blockslides/core';
2
+
3
+ interface SlideOptions {
4
+ /**
5
+ * The HTML attributes for a slide node.
6
+ * @default {}
7
+ * @example { class: 'foo' }
8
+ */
9
+ HTMLAttributes: Record<string, any>;
10
+ /**
11
+ * Whether to inject CSS styles
12
+ * @default true
13
+ */
14
+ injectCSS: boolean;
15
+ /**
16
+ * Content Security Policy nonce
17
+ */
18
+ injectNonce?: string;
19
+ }
20
+ declare const Slide: Node<SlideOptions, any>;
21
+
22
+ export { Slide };
@@ -0,0 +1,22 @@
1
+ import { Node } from '@blockslides/core';
2
+
3
+ interface SlideOptions {
4
+ /**
5
+ * The HTML attributes for a slide node.
6
+ * @default {}
7
+ * @example { class: 'foo' }
8
+ */
9
+ HTMLAttributes: Record<string, any>;
10
+ /**
11
+ * Whether to inject CSS styles
12
+ * @default true
13
+ */
14
+ injectCSS: boolean;
15
+ /**
16
+ * Content Security Policy nonce
17
+ */
18
+ injectNonce?: string;
19
+ }
20
+ declare const Slide: Node<SlideOptions, any>;
21
+
22
+ export { Slide };
package/dist/index.js ADDED
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ Slide: () => Slide
24
+ });
25
+ module.exports = __toCommonJS(index_exports);
26
+
27
+ // src/slide.ts
28
+ var import_core = require("@blockslides/core");
29
+ var import_state = require("@blockslides/pm/state");
30
+ var slideStyles = `
31
+ .slide {
32
+ height: var(--slide-height, 100%);
33
+ min-height: var(--slide-min-height, 250px);
34
+ display: flex;
35
+ flex-direction: column;
36
+ overflow: hidden;
37
+ background-color: var(--slide-bg);
38
+ border-radius: var(--slide-border-radius);
39
+ box-shadow: var(--slide-shadow);
40
+ margin-bottom: var(--slide-margin-bottom);
41
+ }
42
+ `;
43
+ var SlidePluginKey = new import_state.PluginKey("slide");
44
+ var Slide = import_core.Node.create({
45
+ name: "slide",
46
+ isolating: true,
47
+ content: "row+",
48
+ group: "slide",
49
+ defining: true,
50
+ addOptions() {
51
+ return {
52
+ HTMLAttributes: {},
53
+ injectCSS: true,
54
+ injectNonce: void 0
55
+ };
56
+ },
57
+ parseHTML() {
58
+ return [{ tag: "div.slide" }];
59
+ },
60
+ renderHTML({ HTMLAttributes }) {
61
+ return [
62
+ "div",
63
+ (0, import_core.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes, {
64
+ class: "slide",
65
+ "data-node-type": "slide"
66
+ }),
67
+ 0
68
+ ];
69
+ },
70
+ addProseMirrorPlugins() {
71
+ return [
72
+ new import_state.Plugin({
73
+ key: SlidePluginKey,
74
+ state: {
75
+ init: () => {
76
+ if (this.options.injectCSS && typeof document !== "undefined") {
77
+ (0, import_core.createStyleTag)(slideStyles, this.options.injectNonce, "slide");
78
+ }
79
+ return {};
80
+ },
81
+ apply: (_tr, pluginState) => pluginState
82
+ }
83
+ })
84
+ ];
85
+ }
86
+ });
87
+ // Annotate the CommonJS export names for ESM import in node:
88
+ 0 && (module.exports = {
89
+ Slide
90
+ });
91
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/slide.ts"],"sourcesContent":["export { Slide } from \"./slide\";\n","import { Node, mergeAttributes, createStyleTag } from \"@blockslides/core\";\nimport { Plugin, PluginKey } from \"@blockslides/pm/state\";\n\nconst slideStyles = `\n.slide {\n height: var(--slide-height, 100%);\n min-height: var(--slide-min-height, 250px);\n display: flex;\n flex-direction: column;\n overflow: hidden;\n background-color: var(--slide-bg);\n border-radius: var(--slide-border-radius);\n box-shadow: var(--slide-shadow);\n margin-bottom: var(--slide-margin-bottom);\n}\n`;\n\nexport interface SlideOptions {\n /**\n * The HTML attributes for a slide node.\n * @default {}\n * @example { class: 'foo' }\n */\n HTMLAttributes: Record<string, any>;\n /**\n * Whether to inject CSS styles\n * @default true\n */\n injectCSS: boolean;\n /**\n * Content Security Policy nonce\n */\n injectNonce?: string;\n}\n\nconst SlidePluginKey = new PluginKey(\"slide\");\n\nexport const Slide = Node.create<SlideOptions>({\n name: \"slide\",\n isolating: true,\n content: \"row+\",\n\n group: \"slide\",\n\n defining: true,\n\n addOptions() {\n return {\n HTMLAttributes: {},\n injectCSS: true,\n injectNonce: undefined,\n };\n },\n\n parseHTML() {\n return [{ tag: \"div.slide\" }];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n \"div\",\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, {\n class: \"slide\",\n \"data-node-type\": \"slide\",\n }),\n 0,\n ];\n },\n\n addProseMirrorPlugins() {\n return [\n new Plugin({\n key: SlidePluginKey,\n state: {\n init: () => {\n if (this.options.injectCSS && typeof document !== \"undefined\") {\n createStyleTag(slideStyles, this.options.injectNonce, \"slide\");\n }\n return {};\n },\n apply: (_tr, pluginState: Record<string, never>) => pluginState,\n },\n }),\n ];\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAAsD;AACtD,mBAAkC;AAElC,IAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgCpB,IAAM,iBAAiB,IAAI,uBAAU,OAAO;AAErC,IAAM,QAAQ,iBAAK,OAAqB;AAAA,EAC7C,MAAM;AAAA,EACN,WAAW;AAAA,EACX,SAAS;AAAA,EAET,OAAO;AAAA,EAEP,UAAU;AAAA,EAEV,aAAa;AACX,WAAO;AAAA,MACL,gBAAgB,CAAC;AAAA,MACjB,WAAW;AAAA,MACX,aAAa;AAAA,IACf;AAAA,EACF;AAAA,EAEA,YAAY;AACV,WAAO,CAAC,EAAE,KAAK,YAAY,CAAC;AAAA,EAC9B;AAAA,EAEA,WAAW,EAAE,eAAe,GAAG;AAC7B,WAAO;AAAA,MACL;AAAA,UACA,6BAAgB,KAAK,QAAQ,gBAAgB,gBAAgB;AAAA,QAC3D,OAAO;AAAA,QACP,kBAAkB;AAAA,MACpB,CAAC;AAAA,MACD;AAAA,IACF;AAAA,EACF;AAAA,EAEA,wBAAwB;AACtB,WAAO;AAAA,MACL,IAAI,oBAAO;AAAA,QACT,KAAK;AAAA,QACL,OAAO;AAAA,UACL,MAAM,MAAM;AACV,gBAAI,KAAK,QAAQ,aAAa,OAAO,aAAa,aAAa;AAC7D,8CAAe,aAAa,KAAK,QAAQ,aAAa,OAAO;AAAA,YAC/D;AACA,mBAAO,CAAC;AAAA,UACV;AAAA,UACA,OAAO,CAAC,KAAK,gBAAuC;AAAA,QACtD;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF,CAAC;","names":[]}
package/dist/index.mjs ADDED
@@ -0,0 +1,64 @@
1
+ // src/slide.ts
2
+ import { Node, mergeAttributes, createStyleTag } from "@blockslides/core";
3
+ import { Plugin, PluginKey } from "@blockslides/pm/state";
4
+ var slideStyles = `
5
+ .slide {
6
+ height: var(--slide-height, 100%);
7
+ min-height: var(--slide-min-height, 250px);
8
+ display: flex;
9
+ flex-direction: column;
10
+ overflow: hidden;
11
+ background-color: var(--slide-bg);
12
+ border-radius: var(--slide-border-radius);
13
+ box-shadow: var(--slide-shadow);
14
+ margin-bottom: var(--slide-margin-bottom);
15
+ }
16
+ `;
17
+ var SlidePluginKey = new PluginKey("slide");
18
+ var Slide = Node.create({
19
+ name: "slide",
20
+ isolating: true,
21
+ content: "row+",
22
+ group: "slide",
23
+ defining: true,
24
+ addOptions() {
25
+ return {
26
+ HTMLAttributes: {},
27
+ injectCSS: true,
28
+ injectNonce: void 0
29
+ };
30
+ },
31
+ parseHTML() {
32
+ return [{ tag: "div.slide" }];
33
+ },
34
+ renderHTML({ HTMLAttributes }) {
35
+ return [
36
+ "div",
37
+ mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, {
38
+ class: "slide",
39
+ "data-node-type": "slide"
40
+ }),
41
+ 0
42
+ ];
43
+ },
44
+ addProseMirrorPlugins() {
45
+ return [
46
+ new Plugin({
47
+ key: SlidePluginKey,
48
+ state: {
49
+ init: () => {
50
+ if (this.options.injectCSS && typeof document !== "undefined") {
51
+ createStyleTag(slideStyles, this.options.injectNonce, "slide");
52
+ }
53
+ return {};
54
+ },
55
+ apply: (_tr, pluginState) => pluginState
56
+ }
57
+ })
58
+ ];
59
+ }
60
+ });
61
+ export {
62
+ Slide
63
+ };
64
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/slide.ts"],"sourcesContent":["import { Node, mergeAttributes, createStyleTag } from \"@blockslides/core\";\nimport { Plugin, PluginKey } from \"@blockslides/pm/state\";\n\nconst slideStyles = `\n.slide {\n height: var(--slide-height, 100%);\n min-height: var(--slide-min-height, 250px);\n display: flex;\n flex-direction: column;\n overflow: hidden;\n background-color: var(--slide-bg);\n border-radius: var(--slide-border-radius);\n box-shadow: var(--slide-shadow);\n margin-bottom: var(--slide-margin-bottom);\n}\n`;\n\nexport interface SlideOptions {\n /**\n * The HTML attributes for a slide node.\n * @default {}\n * @example { class: 'foo' }\n */\n HTMLAttributes: Record<string, any>;\n /**\n * Whether to inject CSS styles\n * @default true\n */\n injectCSS: boolean;\n /**\n * Content Security Policy nonce\n */\n injectNonce?: string;\n}\n\nconst SlidePluginKey = new PluginKey(\"slide\");\n\nexport const Slide = Node.create<SlideOptions>({\n name: \"slide\",\n isolating: true,\n content: \"row+\",\n\n group: \"slide\",\n\n defining: true,\n\n addOptions() {\n return {\n HTMLAttributes: {},\n injectCSS: true,\n injectNonce: undefined,\n };\n },\n\n parseHTML() {\n return [{ tag: \"div.slide\" }];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n \"div\",\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, {\n class: \"slide\",\n \"data-node-type\": \"slide\",\n }),\n 0,\n ];\n },\n\n addProseMirrorPlugins() {\n return [\n new Plugin({\n key: SlidePluginKey,\n state: {\n init: () => {\n if (this.options.injectCSS && typeof document !== \"undefined\") {\n createStyleTag(slideStyles, this.options.injectNonce, \"slide\");\n }\n return {};\n },\n apply: (_tr, pluginState: Record<string, never>) => pluginState,\n },\n }),\n ];\n },\n});\n"],"mappings":";AAAA,SAAS,MAAM,iBAAiB,sBAAsB;AACtD,SAAS,QAAQ,iBAAiB;AAElC,IAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgCpB,IAAM,iBAAiB,IAAI,UAAU,OAAO;AAErC,IAAM,QAAQ,KAAK,OAAqB;AAAA,EAC7C,MAAM;AAAA,EACN,WAAW;AAAA,EACX,SAAS;AAAA,EAET,OAAO;AAAA,EAEP,UAAU;AAAA,EAEV,aAAa;AACX,WAAO;AAAA,MACL,gBAAgB,CAAC;AAAA,MACjB,WAAW;AAAA,MACX,aAAa;AAAA,IACf;AAAA,EACF;AAAA,EAEA,YAAY;AACV,WAAO,CAAC,EAAE,KAAK,YAAY,CAAC;AAAA,EAC9B;AAAA,EAEA,WAAW,EAAE,eAAe,GAAG;AAC7B,WAAO;AAAA,MACL;AAAA,MACA,gBAAgB,KAAK,QAAQ,gBAAgB,gBAAgB;AAAA,QAC3D,OAAO;AAAA,QACP,kBAAkB;AAAA,MACpB,CAAC;AAAA,MACD;AAAA,IACF;AAAA,EACF;AAAA,EAEA,wBAAwB;AACtB,WAAO;AAAA,MACL,IAAI,OAAO;AAAA,QACT,KAAK;AAAA,QACL,OAAO;AAAA,UACL,MAAM,MAAM;AACV,gBAAI,KAAK,QAAQ,aAAa,OAAO,aAAa,aAAa;AAC7D,6BAAe,aAAa,KAAK,QAAQ,aAAa,OAAO;AAAA,YAC/D;AACA,mBAAO,CAAC;AAAA,UACV;AAAA,UACA,OAAO,CAAC,KAAK,gBAAuC;AAAA,QACtD;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF,CAAC;","names":[]}
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@blockslides/extension-slide",
3
+ "version": "0.1.0",
4
+ "description": "Slide node extension for BlockSlides slide editor",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "types": "dist/index.d.ts",
8
+ "keywords": [
9
+ "blockslides",
10
+ "blockslides extension",
11
+ "slide"
12
+ ],
13
+ "peerDependencies": {
14
+ "@blockslides/core": "^0.1.0",
15
+ "@blockslides/pm": "^0.1.0"
16
+ },
17
+ "dependencies": {
18
+ "@blockslides/core": "^0.1.0",
19
+ "@blockslides/pm": "^0.1.0"
20
+ },
21
+ "devDependencies": {
22
+ "tsup": "^8.0.0",
23
+ "typescript": "^5.3.3"
24
+ },
25
+ "author": "keivanmojmali",
26
+ "scripts": {
27
+ "build": "tsup",
28
+ "dev": "tsup --watch"
29
+ }
30
+ }
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export { Slide } from "./slide";
package/src/slide.ts ADDED
@@ -0,0 +1,86 @@
1
+ import { Node, mergeAttributes, createStyleTag } from "@blockslides/core";
2
+ import { Plugin, PluginKey } from "@blockslides/pm/state";
3
+
4
+ const slideStyles = `
5
+ .slide {
6
+ height: var(--slide-height, 100%);
7
+ min-height: var(--slide-min-height, 250px);
8
+ display: flex;
9
+ flex-direction: column;
10
+ overflow: hidden;
11
+ background-color: var(--slide-bg);
12
+ border-radius: var(--slide-border-radius);
13
+ box-shadow: var(--slide-shadow);
14
+ margin-bottom: var(--slide-margin-bottom);
15
+ }
16
+ `;
17
+
18
+ export interface SlideOptions {
19
+ /**
20
+ * The HTML attributes for a slide node.
21
+ * @default {}
22
+ * @example { class: 'foo' }
23
+ */
24
+ HTMLAttributes: Record<string, any>;
25
+ /**
26
+ * Whether to inject CSS styles
27
+ * @default true
28
+ */
29
+ injectCSS: boolean;
30
+ /**
31
+ * Content Security Policy nonce
32
+ */
33
+ injectNonce?: string;
34
+ }
35
+
36
+ const SlidePluginKey = new PluginKey("slide");
37
+
38
+ export const Slide = Node.create<SlideOptions>({
39
+ name: "slide",
40
+ isolating: true,
41
+ content: "row+",
42
+
43
+ group: "slide",
44
+
45
+ defining: true,
46
+
47
+ addOptions() {
48
+ return {
49
+ HTMLAttributes: {},
50
+ injectCSS: true,
51
+ injectNonce: undefined,
52
+ };
53
+ },
54
+
55
+ parseHTML() {
56
+ return [{ tag: "div.slide" }];
57
+ },
58
+
59
+ renderHTML({ HTMLAttributes }) {
60
+ return [
61
+ "div",
62
+ mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, {
63
+ class: "slide",
64
+ "data-node-type": "slide",
65
+ }),
66
+ 0,
67
+ ];
68
+ },
69
+
70
+ addProseMirrorPlugins() {
71
+ return [
72
+ new Plugin({
73
+ key: SlidePluginKey,
74
+ state: {
75
+ init: () => {
76
+ if (this.options.injectCSS && typeof document !== "undefined") {
77
+ createStyleTag(slideStyles, this.options.injectNonce, "slide");
78
+ }
79
+ return {};
80
+ },
81
+ apply: (_tr, pluginState: Record<string, never>) => pluginState,
82
+ },
83
+ }),
84
+ ];
85
+ },
86
+ });
package/tsconfig.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "../../tsconfig.build.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist",
5
+ "rootDir": "./src"
6
+ },
7
+ "include": ["src"]
8
+ }
package/tsup.config.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { defineConfig } from "tsup";
2
+
3
+ export default defineConfig({
4
+ entry: ["src/index.ts", "src/slide.css"],
5
+ format: ["cjs", "esm"],
6
+ dts: true,
7
+ clean: true,
8
+ sourcemap: true,
9
+ loader: {
10
+ ".css": "copy",
11
+ },
12
+ });