@widlarzgroup/docusaurus-ui 0.0.4 → 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.
Files changed (35) hide show
  1. package/lib/components/ProBadge/ProBadge.module.css +1 -1
  2. package/lib/components/ProFeature/ProFeature.d.ts.map +1 -1
  3. package/lib/components/ProFeature/ProFeature.js +4 -2
  4. package/lib/components/ProFeature/ProFeature.js.map +1 -1
  5. package/lib/components/ProFeature/ProFeature.module.css +71 -34
  6. package/lib/createSidebarWithCustomProps.d.ts +30 -0
  7. package/lib/createSidebarWithCustomProps.d.ts.map +1 -0
  8. package/lib/createSidebarWithCustomProps.js +53 -0
  9. package/lib/createSidebarWithCustomProps.js.map +1 -0
  10. package/lib/css/custom.css +12 -0
  11. package/lib/hooks/useParentCategoryCustomProps.d.ts +15 -0
  12. package/lib/hooks/useParentCategoryCustomProps.d.ts.map +1 -0
  13. package/lib/hooks/useParentCategoryCustomProps.js +31 -0
  14. package/lib/hooks/useParentCategoryCustomProps.js.map +1 -0
  15. package/lib/index.d.ts +1 -0
  16. package/lib/index.d.ts.map +1 -1
  17. package/lib/index.js +19 -1
  18. package/lib/index.js.map +1 -1
  19. package/lib/theme/DocItem/Content/index.d.ts +4 -0
  20. package/lib/theme/DocItem/Content/index.d.ts.map +1 -0
  21. package/lib/theme/DocItem/Content/index.js +53 -0
  22. package/lib/theme/DocItem/Content/index.js.map +1 -0
  23. package/package.json +2 -2
  24. package/src/components/ProBadge/ProBadge.module.css +1 -1
  25. package/src/components/ProFeature/ProFeature.module.css +71 -34
  26. package/src/components/ProFeature/ProFeature.tsx +24 -32
  27. package/src/createSidebarWithCustomProps.ts +63 -0
  28. package/src/css/custom.css +12 -0
  29. package/src/hooks/useParentCategoryCustomProps.ts +31 -0
  30. package/src/index.ts +19 -1
  31. package/src/theme/DocItem/Content/index.tsx +67 -0
  32. package/lib/theme/DocItem/TOC/Desktop/index.d.ts +0 -3
  33. package/lib/theme/DocItem/TOC/Desktop/index.d.ts.map +0 -1
  34. package/lib/theme/DocItem/TOC/Desktop/index.js +0 -15
  35. package/lib/theme/DocItem/TOC/Desktop/index.js.map +0 -1
@@ -3,6 +3,6 @@
3
3
  align-items: center;
4
4
  justify-content: center;
5
5
  margin-left: 6px;
6
- color: #a855f7;
6
+ color: var(--color-pro, #B897FF);
7
7
  flex-shrink: 0;
8
8
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ProFeature.d.ts","sourceRoot":"","sources":["../../../src/components/ProFeature/ProFeature.tsx"],"names":[],"mappings":"AAEA,UAAU,eAAe;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,QAAA,MAAM,UAAU,4BAGb,eAAe,4CAsCjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"ProFeature.d.ts","sourceRoot":"","sources":["../../../src/components/ProFeature/ProFeature.tsx"],"names":[],"mappings":"AAIA,UAAU,eAAe;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,QAAA,MAAM,UAAU,4BAGb,eAAe,4CA4BjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -4,9 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const Link_1 = __importDefault(require("@docusaurus/Link"));
7
8
  const ProFeature_module_css_1 = __importDefault(require("./ProFeature.module.css"));
8
- const ProFeature = ({ title = 'Pro Feature', description = 'This feature is part of our commercial offering. Start a free trial to explore all Pro features.', }) => {
9
- return ((0, jsx_runtime_1.jsxs)("div", { className: ProFeature_module_css_1.default.container, children: [(0, jsx_runtime_1.jsx)("div", { className: ProFeature_module_css_1.default.header, children: (0, jsx_runtime_1.jsxs)("div", { className: ProFeature_module_css_1.default.badge, children: [(0, jsx_runtime_1.jsx)("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "currentColor", className: ProFeature_module_css_1.default.icon, children: (0, jsx_runtime_1.jsx)("path", { d: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" }) }), (0, jsx_runtime_1.jsx)("span", { className: ProFeature_module_css_1.default.badgeText, children: title })] }) }), (0, jsx_runtime_1.jsx)("p", { className: ProFeature_module_css_1.default.description, children: description }), (0, jsx_runtime_1.jsxs)("div", { className: ProFeature_module_css_1.default.actions, children: [(0, jsx_runtime_1.jsx)("a", { href: "https://sdk.thewidlarzgroup.com/signup?utm_source=rnv&utm_medium=docs&utm_campaign=pro-feature", target: "_blank", rel: "noreferrer", className: ProFeature_module_css_1.default.primaryButton, children: "Start Free Trial" }), (0, jsx_runtime_1.jsx)("a", { href: "https://www.thewidlarzgroup.com/?utm_source=rnv&utm_medium=docs&utm_campaign=pro-feature#Contact", target: "_blank", rel: "noreferrer", className: ProFeature_module_css_1.default.secondaryButton, children: "Contact Sales" })] })] }));
9
+ const ProBadge_1 = __importDefault(require("../../components/ProBadge/ProBadge"));
10
+ const ProFeature = ({ title = 'Pro Player Feature', description = 'This feature is available exclusively in Pro Player. To access this functionality, please contact us.', }) => {
11
+ return ((0, jsx_runtime_1.jsx)("div", { className: ProFeature_module_css_1.default.container, children: (0, jsx_runtime_1.jsxs)("div", { className: ProFeature_module_css_1.default.content, children: [(0, jsx_runtime_1.jsx)("div", { className: ProFeature_module_css_1.default.header, children: (0, jsx_runtime_1.jsxs)("div", { className: ProFeature_module_css_1.default.badge, children: [(0, jsx_runtime_1.jsx)(ProBadge_1.default, {}), (0, jsx_runtime_1.jsx)("span", { className: ProFeature_module_css_1.default.badgeText, children: title })] }) }), (0, jsx_runtime_1.jsx)("p", { className: ProFeature_module_css_1.default.description, children: description }), (0, jsx_runtime_1.jsxs)("div", { className: ProFeature_module_css_1.default.actions, children: [(0, jsx_runtime_1.jsx)(Link_1.default, { to: "https://thewidlarzgroup.com/?utm_source=docs&utm_medium=pro-feature&utm_campaign=pro-player#Contact", className: ProFeature_module_css_1.default.primaryButton, children: "Contact Us" }), (0, jsx_runtime_1.jsx)(Link_1.default, { to: "https://sdk.thewidlarzgroup.com/?utm_source=docs&utm_medium=pro-feature&utm_campaign=pro-player", className: ProFeature_module_css_1.default.secondaryButton, children: "Learn More" })] })] }) }));
10
12
  };
11
13
  exports.default = ProFeature;
12
14
  //# sourceMappingURL=ProFeature.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProFeature.js","sourceRoot":"","sources":["../../../src/components/ProFeature/ProFeature.tsx"],"names":[],"mappings":";;;;;;AAAA,oFAA6C;AAO7C,MAAM,UAAU,GAAG,CAAC,EAClB,KAAK,GAAG,aAAa,EACrB,WAAW,GAAG,kGAAkG,GAChG,EAAE,EAAE;IACpB,OAAO,CACL,iCAAK,SAAS,EAAE,+BAAM,CAAC,SAAS,aAC9B,gCAAK,SAAS,EAAE,+BAAM,CAAC,MAAM,YAC3B,iCAAK,SAAS,EAAE,+BAAM,CAAC,KAAK,aAC1B,gCACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,cAAc,EACnB,SAAS,EAAE,+BAAM,CAAC,IAAI,YAEtB,iCAAM,CAAC,EAAC,qCAAqC,GAAG,GAC5C,EACN,iCAAM,SAAS,EAAE,+BAAM,CAAC,SAAS,YAAG,KAAK,GAAQ,IAC7C,GACF,EACN,8BAAG,SAAS,EAAE,+BAAM,CAAC,WAAW,YAAG,WAAW,GAAK,EACnD,iCAAK,SAAS,EAAE,+BAAM,CAAC,OAAO,aAC5B,8BACE,IAAI,EAAC,gGAAgG,EACrG,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,YAAY,EAChB,SAAS,EAAE,+BAAM,CAAC,aAAa,iCAG7B,EACJ,8BACE,IAAI,EAAC,kGAAkG,EACvG,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,YAAY,EAChB,SAAS,EAAE,+BAAM,CAAC,eAAe,8BAG/B,IACA,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"ProFeature.js","sourceRoot":"","sources":["../../../src/components/ProFeature/ProFeature.tsx"],"names":[],"mappings":";;;;;;AAAA,4DAAoC;AACpC,oFAA6C;AAC7C,8EAAsD;AAOtD,MAAM,UAAU,GAAG,CAAC,EAClB,KAAK,GAAG,oBAAoB,EAC5B,WAAW,GAAG,uGAAuG,GACrG,EAAE,EAAE;IACpB,OAAO,CACL,gCAAK,SAAS,EAAE,+BAAM,CAAC,SAAS,YAC9B,iCAAK,SAAS,EAAE,+BAAM,CAAC,OAAO,aAC5B,gCAAK,SAAS,EAAE,+BAAM,CAAC,MAAM,YAC3B,iCAAK,SAAS,EAAE,+BAAM,CAAC,KAAK,aAC1B,uBAAC,kBAAQ,KAAG,EACZ,iCAAM,SAAS,EAAE,+BAAM,CAAC,SAAS,YAAG,KAAK,GAAQ,IAC7C,GACF,EACN,8BAAG,SAAS,EAAE,+BAAM,CAAC,WAAW,YAAG,WAAW,GAAK,EACnD,iCAAK,SAAS,EAAE,+BAAM,CAAC,OAAO,aAC5B,uBAAC,cAAI,IACH,EAAE,EAAC,qGAAqG,EACxG,SAAS,EAAE,+BAAM,CAAC,aAAa,2BAG1B,EACP,uBAAC,cAAI,IACH,EAAE,EAAC,iGAAiG,EACpG,SAAS,EAAE,+BAAM,CAAC,eAAe,2BAG5B,IACH,IACF,GACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,UAAU,CAAC"}
@@ -1,10 +1,53 @@
1
1
  .container {
2
+ position: relative;
2
3
  margin: 1.5rem 0;
3
- padding: 1.25rem 1.5rem;
4
- background: rgba(150, 201, 235, 0.08);
5
- border: 1px solid rgba(150, 201, 235, 0.2);
6
- border-left: 4px solid #96c9eb;
7
- border-radius: 8px;
4
+ padding: 1.5rem;
5
+ background:
6
+ /* Top-left subtle glow */
7
+ radial-gradient(ellipse 40% 50% at 15% 10%, color-mix(in srgb, var(--color-pro) 6%, transparent), transparent 50%),
8
+ /* Bottom-right accent */
9
+ radial-gradient(ellipse 35% 40% at 85% 90%, color-mix(in srgb, var(--color-pro) 4%, transparent), transparent 50%),
10
+ /* Base */
11
+ var(--color-bg-primary);
12
+ border: 1px solid var(--color-pro-border, color-mix(in srgb, var(--color-pro) 50%, transparent));
13
+ border-radius: 12px;
14
+ overflow: hidden;
15
+ }
16
+
17
+ /* Grid pattern - circular fade from top */
18
+ .container::before {
19
+ content: '';
20
+ position: absolute;
21
+ top: -52%;
22
+ left: 50%;
23
+ transform: translateX(-50%);
24
+ width: 160%;
25
+ height: 220%;
26
+ background:
27
+ linear-gradient(color-mix(in srgb, var(--color-pro) 7%, transparent) 1px, transparent 1px),
28
+ linear-gradient(90deg, color-mix(in srgb, var(--color-pro) 7%, transparent) 1px, transparent 1px);
29
+ background-size: 20px 20px;
30
+ mask-image: radial-gradient(ellipse 55% 45% at 50% 25%, black 0%, transparent 70%);
31
+ -webkit-mask-image: radial-gradient(ellipse 55% 45% at 50% 25%, black 0%, transparent 70%);
32
+ pointer-events: none;
33
+ }
34
+
35
+ /* Main glow accent - smaller, centered */
36
+ .container::after {
37
+ content: '';
38
+ position: absolute;
39
+ top: -30%;
40
+ left: 50%;
41
+ transform: translateX(-50%);
42
+ width: 50%;
43
+ height: 60%;
44
+ background: radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--color-pro-dim) 10%, transparent), transparent 70%);
45
+ pointer-events: none;
46
+ }
47
+
48
+ .content {
49
+ position: relative;
50
+ z-index: 1;
8
51
  }
9
52
 
10
53
  .header {
@@ -16,28 +59,25 @@
16
59
  .badge {
17
60
  display: inline-flex;
18
61
  align-items: center;
19
- gap: 0.4rem;
20
- padding: 0.3rem 0.6rem;
21
- background: linear-gradient(135deg, #96c9eb 0%, #76b8e5 100%);
22
- border-radius: 4px;
23
- }
24
-
25
- .icon {
26
- color: #171717;
62
+ gap: 0.5rem;
63
+ padding: 0.4rem 0.75rem;
64
+ background: color-mix(in srgb, var(--color-pro) 8%, transparent);
65
+ border: 1px solid var(--color-pro-border, color-mix(in srgb, var(--color-pro) 50%, transparent));
66
+ border-radius: 6px;
27
67
  }
28
68
 
29
69
  .badgeText {
30
70
  font-size: 0.75rem;
31
71
  font-weight: 700;
32
- color: #171717;
72
+ color: var(--color-pro);
33
73
  text-transform: uppercase;
34
- letter-spacing: 0.03em;
74
+ letter-spacing: 0.05em;
35
75
  }
36
76
 
37
77
  .description {
38
- margin: 0 0 1rem 0;
78
+ margin: 0 0 1.25rem 0;
39
79
  font-size: 0.9rem;
40
- color: var(--color-text-secondary, #b4b4b4);
80
+ color: var(--color-text-secondary);
41
81
  line-height: 1.6;
42
82
  }
43
83
 
@@ -50,40 +90,37 @@
50
90
  .primaryButton {
51
91
  display: inline-flex;
52
92
  align-items: center;
53
- padding: 0.5rem 1rem;
54
- background: #96c9eb;
55
- color: #171717;
56
- font-size: 0.85rem;
93
+ padding: 0.55rem 1.1rem;
94
+ background: transparent;
95
+ color: var(--color-pro) !important;
96
+ font-size: 0.8rem;
57
97
  font-weight: 600;
98
+ border-bottom: 1px solid var(--color-pro) !important;
58
99
  border-radius: 6px;
59
100
  text-decoration: none;
60
- transition: all 0.2s ease;
101
+ transition: all 0.15s ease;
61
102
  }
62
103
 
63
104
  .primaryButton:hover {
64
- background: #76b8e5;
65
- color: #171717;
105
+ opacity: 0.7;
66
106
  text-decoration: none;
67
107
  }
68
108
 
69
109
  .secondaryButton {
70
110
  display: inline-flex;
71
111
  align-items: center;
72
- padding: 0.5rem 1rem;
112
+ padding: 0.55rem 1.1rem;
73
113
  background: transparent;
74
- color: #96c9eb;
75
- font-size: 0.85rem;
76
- font-weight: 600;
77
- border: 1px solid rgba(150, 201, 235, 0.3);
114
+ color: var(--color-text-primary) !important;
115
+ font-size: 0.8rem;
116
+ font-weight: 500;
117
+ border-color: var(--color-text-primary) !important;
78
118
  border-radius: 6px;
79
119
  text-decoration: none;
80
- transition: all 0.2s ease;
120
+ transition: all 0.15s ease;
81
121
  }
82
122
 
83
123
  .secondaryButton:hover {
84
- background: rgba(150, 201, 235, 0.1);
85
- border-color: rgba(150, 201, 235, 0.5);
86
- color: #96c9eb;
124
+ opacity: 0.7;
87
125
  text-decoration: none;
88
126
  }
89
-
@@ -0,0 +1,30 @@
1
+ import type { PluginOptions } from '@docusaurus/plugin-content-docs';
2
+ type SidebarItemsGenerator = NonNullable<PluginOptions['sidebarItemsGenerator']>;
3
+ /**
4
+ * Adds customProps from document frontmatter to sidebar items.
5
+ * This enables using customProps in .md files, not just _category_.json.
6
+ *
7
+ * @example
8
+ * // docusaurus.config.ts
9
+ * import { createSidebarWithCustomProps } from '@widlarzgroup/docusaurus-ui';
10
+ *
11
+ * export default {
12
+ * presets: [
13
+ * ['classic', {
14
+ * docs: {
15
+ * sidebarItemsGenerator: createSidebarWithCustomProps,
16
+ * },
17
+ * }],
18
+ * ],
19
+ * };
20
+ *
21
+ * // Then in your .md file:
22
+ * // ---
23
+ * // customProps:
24
+ * // badgeType: new
25
+ * // plan: pro
26
+ * // ---
27
+ */
28
+ export declare const createSidebarWithCustomProps: SidebarItemsGenerator;
29
+ export {};
30
+ //# sourceMappingURL=createSidebarWithCustomProps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createSidebarWithCustomProps.d.ts","sourceRoot":"","sources":["../src/createSidebarWithCustomProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAErE,KAAK,qBAAqB,GAAG,WAAW,CAAC,aAAa,CAAC,uBAAuB,CAAC,CAAC,CAAC;AAIjF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,4BAA4B,EAAE,qBA+B1C,CAAC"}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createSidebarWithCustomProps = void 0;
4
+ /**
5
+ * Adds customProps from document frontmatter to sidebar items.
6
+ * This enables using customProps in .md files, not just _category_.json.
7
+ *
8
+ * @example
9
+ * // docusaurus.config.ts
10
+ * import { createSidebarWithCustomProps } from '@widlarzgroup/docusaurus-ui';
11
+ *
12
+ * export default {
13
+ * presets: [
14
+ * ['classic', {
15
+ * docs: {
16
+ * sidebarItemsGenerator: createSidebarWithCustomProps,
17
+ * },
18
+ * }],
19
+ * ],
20
+ * };
21
+ *
22
+ * // Then in your .md file:
23
+ * // ---
24
+ * // customProps:
25
+ * // badgeType: new
26
+ * // plan: pro
27
+ * // ---
28
+ */
29
+ const createSidebarWithCustomProps = async ({ defaultSidebarItemsGenerator, docs, ...args }) => {
30
+ const sidebarItems = await defaultSidebarItemsGenerator({ docs, ...args });
31
+ function addCustomPropsFromFrontmatter(items) {
32
+ return items.map((item) => {
33
+ if (item.type === 'category') {
34
+ return { ...item, items: addCustomPropsFromFrontmatter(item.items) };
35
+ }
36
+ // Only 'doc' type has id that matches docs array
37
+ if (item.type === 'doc') {
38
+ const doc = docs.find((d) => d.id === item.id);
39
+ const frontmatterCustomProps = doc?.frontMatter?.customProps;
40
+ if (frontmatterCustomProps && typeof frontmatterCustomProps === 'object') {
41
+ return {
42
+ ...item,
43
+ customProps: { ...item.customProps, ...frontmatterCustomProps },
44
+ };
45
+ }
46
+ }
47
+ return item;
48
+ });
49
+ }
50
+ return addCustomPropsFromFrontmatter(sidebarItems);
51
+ };
52
+ exports.createSidebarWithCustomProps = createSidebarWithCustomProps;
53
+ //# sourceMappingURL=createSidebarWithCustomProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createSidebarWithCustomProps.js","sourceRoot":"","sources":["../src/createSidebarWithCustomProps.ts"],"names":[],"mappings":";;;AAMA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACI,MAAM,4BAA4B,GAA0B,KAAK,EAAE,EACxE,4BAA4B,EAC5B,IAAI,EACJ,GAAG,IAAI,EACO,EAAE,EAAE;IAClB,MAAM,YAAY,GAAG,MAAM,4BAA4B,CAAC,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;IAE3E,SAAS,6BAA6B,CAAC,KAAoB;QACzD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YACxB,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;gBAC7B,OAAO,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,6BAA6B,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YACvE,CAAC;YAED,iDAAiD;YACjD,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;gBACxB,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC,CAAC;gBAC/C,MAAM,sBAAsB,GAAG,GAAG,EAAE,WAAW,EAAE,WAAW,CAAC;gBAE7D,IAAI,sBAAsB,IAAI,OAAO,sBAAsB,KAAK,QAAQ,EAAE,CAAC;oBACzE,OAAO;wBACL,GAAG,IAAI;wBACP,WAAW,EAAE,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE,GAAG,sBAAsB,EAAE;qBAChE,CAAC;gBACJ,CAAC;YACH,CAAC;YAED,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,6BAA6B,CAAC,YAAY,CAAC,CAAC;AACrD,CAAC,CAAC;AA/BW,QAAA,4BAA4B,gCA+BvC"}
@@ -19,6 +19,12 @@
19
19
  --color-secondary-glow: rgba(232, 196, 32, 0.35);
20
20
  --color-secondary-subtle: rgba(232, 196, 32, 0.18);
21
21
 
22
+ --color-pro: #B897FF;
23
+ --color-pro-dim: #A07EF0;
24
+ --color-pro-glow: color-mix(in srgb, var(--color-pro) 25%, transparent);
25
+ --color-pro-subtle: color-mix(in srgb, var(--color-pro) 12%, transparent);
26
+ --color-pro-border: color-mix(in srgb, var(--color-pro) 85%, transparent);
27
+
22
28
  --color-text-primary: #1a1a1a;
23
29
  --color-text-secondary: #4a4a4a;
24
30
  --color-text-muted: #6a6a6a;
@@ -106,6 +112,12 @@
106
112
  --color-secondary-glow: rgba(250, 216, 91, 0.2);
107
113
  --color-secondary-subtle: rgba(250, 216, 91, 0.1);
108
114
 
115
+ --color-pro: #B897FF;
116
+ --color-pro-dim: #A07EF0;
117
+ --color-pro-glow: color-mix(in srgb, var(--color-pro) 20%, transparent);
118
+ --color-pro-subtle: color-mix(in srgb, var(--color-pro) 10%, transparent);
119
+ --color-pro-border: color-mix(in srgb, var(--color-pro) 20%, transparent);
120
+
109
121
  --color-text-primary: #e0e0e0;
110
122
  --color-text-secondary: #a0a0a0;
111
123
  --color-text-muted: #707070;
@@ -0,0 +1,15 @@
1
+ import type { CustomSidebarProps } from '../types/sidebar';
2
+ /**
3
+ * Returns merged customProps from all parent categories in the sidebar breadcrumb.
4
+ * Props from deeper categories override props from parent categories.
5
+ *
6
+ * @example
7
+ * // In a doc page component
8
+ * const { plan, badgeType } = useParentCategoryCustomProps();
9
+ *
10
+ * if (plan === 'pro') {
11
+ * // Show pro badge or restrict content
12
+ * }
13
+ */
14
+ export declare function useParentCategoryCustomProps(): CustomSidebarProps;
15
+ //# sourceMappingURL=useParentCategoryCustomProps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useParentCategoryCustomProps.d.ts","sourceRoot":"","sources":["../../src/hooks/useParentCategoryCustomProps.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAExD;;;;;;;;;;;GAWG;AACH,wBAAgB,4BAA4B,IAAI,kBAAkB,CAejE"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useParentCategoryCustomProps = useParentCategoryCustomProps;
4
+ const client_1 = require("@docusaurus/plugin-content-docs/client");
5
+ /**
6
+ * Returns merged customProps from all parent categories in the sidebar breadcrumb.
7
+ * Props from deeper categories override props from parent categories.
8
+ *
9
+ * @example
10
+ * // In a doc page component
11
+ * const { plan, badgeType } = useParentCategoryCustomProps();
12
+ *
13
+ * if (plan === 'pro') {
14
+ * // Show pro badge or restrict content
15
+ * }
16
+ */
17
+ function useParentCategoryCustomProps() {
18
+ const breadcrumbs = (0, client_1.useSidebarBreadcrumbs)();
19
+ if (!breadcrumbs) {
20
+ return {};
21
+ }
22
+ // Merge customProps from all parent categories (excluding the current doc)
23
+ // Categories closer to the doc override parent categories
24
+ return breadcrumbs.reduce((acc, item) => {
25
+ if (item.type === 'category' && item.customProps) {
26
+ return { ...acc, ...item.customProps };
27
+ }
28
+ return acc;
29
+ }, {});
30
+ }
31
+ //# sourceMappingURL=useParentCategoryCustomProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useParentCategoryCustomProps.js","sourceRoot":"","sources":["../../src/hooks/useParentCategoryCustomProps.ts"],"names":[],"mappings":";;AAeA,oEAeC;AA9BD,mEAA6E;AAG7E;;;;;;;;;;;GAWG;AACH,SAAgB,4BAA4B;IAC1C,MAAM,WAAW,GAAG,IAAA,8BAAqB,GAAE,CAAC;IAE5C,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,2EAA2E;IAC3E,0DAA0D;IAC1D,OAAO,WAAW,CAAC,MAAM,CAAqB,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;QAC1D,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACjD,OAAO,EAAC,GAAG,GAAG,EAAE,GAAG,IAAI,CAAC,WAAiC,EAAC,CAAC;QAC7D,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC"}
package/lib/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { LoadContext, Plugin } from '@docusaurus/types';
2
2
  export default function themeDocusaurusUI(context: LoadContext): Plugin;
3
3
  export * from './types/sidebar';
4
+ export { createSidebarWithCustomProps } from './createSidebarWithCustomProps';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE7D,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAgBtE;AAED,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE7D,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAiCtE;AAED,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC"}
package/lib/index.js CHANGED
@@ -17,13 +17,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.createSidebarWithCustomProps = void 0;
20
21
  exports.default = themeDocusaurusUI;
21
22
  const path_1 = __importDefault(require("path"));
22
23
  function themeDocusaurusUI(context) {
24
+ const isDev = process.env.NODE_ENV === 'development';
23
25
  return {
24
26
  name: '@widlarzgroup/docusaurus-ui',
25
27
  getThemePath() {
26
- return '../lib/theme';
28
+ // In dev mode, use source files directly for hot-reload
29
+ return isDev ? '../src/theme' : '../lib/theme';
27
30
  },
28
31
  getTypeScriptThemePath() {
29
32
  return '../src/theme';
@@ -31,7 +34,22 @@ function themeDocusaurusUI(context) {
31
34
  getClientModules() {
32
35
  return [path_1.default.resolve(__dirname, './css/custom.css')];
33
36
  },
37
+ // Configure webpack to handle TypeScript and path aliases from source
38
+ configureWebpack(config, isServer, utils) {
39
+ if (!isDev)
40
+ return {};
41
+ return {
42
+ resolve: {
43
+ alias: {
44
+ // Resolve @/ imports to source directory
45
+ '@': path_1.default.resolve(__dirname, '../src'),
46
+ },
47
+ },
48
+ };
49
+ },
34
50
  };
35
51
  }
36
52
  __exportStar(require("./types/sidebar"), exports);
53
+ var createSidebarWithCustomProps_1 = require("./createSidebarWithCustomProps");
54
+ Object.defineProperty(exports, "createSidebarWithCustomProps", { enumerable: true, get: function () { return createSidebarWithCustomProps_1.createSidebarWithCustomProps; } });
37
55
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAGA,oCAgBC;AAnBD,gDAAwB;AAGxB,SAAwB,iBAAiB,CAAC,OAAoB;IAC5D,OAAO;QACL,IAAI,EAAE,6BAA6B;QAEnC,YAAY;YACV,OAAO,cAAc,CAAC;QACxB,CAAC;QAED,sBAAsB;YACpB,OAAO,cAAc,CAAC;QACxB,CAAC;QAED,gBAAgB;YACd,OAAO,CAAC,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC,CAAC;QACvD,CAAC;KACF,CAAC;AACJ,CAAC;AAED,kDAAgC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAGA,oCAiCC;AApCD,gDAAwB;AAGxB,SAAwB,iBAAiB,CAAC,OAAoB;IAC5D,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,CAAC;IAErD,OAAO;QACL,IAAI,EAAE,6BAA6B;QAEnC,YAAY;YACV,wDAAwD;YACxD,OAAO,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC;QACjD,CAAC;QAED,sBAAsB;YACpB,OAAO,cAAc,CAAC;QACxB,CAAC;QAED,gBAAgB;YACd,OAAO,CAAC,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC,CAAC;QACvD,CAAC;QAED,sEAAsE;QACtE,gBAAgB,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK;YACtC,IAAI,CAAC,KAAK;gBAAE,OAAO,EAAE,CAAC;YAEtB,OAAO;gBACL,OAAO,EAAE;oBACP,KAAK,EAAE;wBACL,yCAAyC;wBACzC,GAAG,EAAE,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAC;qBACvC;iBACF;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AAED,kDAAgC;AAChC,+EAA8E;AAArE,4IAAA,4BAA4B,OAAA"}
@@ -0,0 +1,4 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { Props } from '@theme/DocItem/Content';
3
+ export default function DocItemContent({ children }: Props): ReactNode;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/theme/DocItem/Content/index.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAM5C,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,wBAAwB,CAAC;AA2ClD,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAAC,QAAQ,EAAC,EAAE,KAAK,GAAG,SAAS,CAiBnE"}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = DocItemContent;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const clsx_1 = __importDefault(require("clsx"));
9
+ const theme_common_1 = require("@docusaurus/theme-common");
10
+ const client_1 = require("@docusaurus/plugin-content-docs/client");
11
+ const Heading_1 = __importDefault(require("@theme/Heading"));
12
+ const MDXContent_1 = __importDefault(require("@theme/MDXContent"));
13
+ const useParentCategoryCustomProps_1 = require("../../../hooks/useParentCategoryCustomProps");
14
+ const ProFeature_1 = __importDefault(require("../../../components/ProFeature/ProFeature"));
15
+ /**
16
+ * Hook that returns doc data + merged customProps from parent categories and frontMatter.
17
+ * Document frontMatter takes precedence over parent category props.
18
+ */
19
+ function useDocWithCustomProps() {
20
+ const doc = (0, client_1.useDoc)();
21
+ const parentCustomProps = (0, useParentCategoryCustomProps_1.useParentCategoryCustomProps)();
22
+ // frontMatter.customProps is not typed, so we need to cast it
23
+ const frontMatter = doc.frontMatter;
24
+ const frontMatterCustomProps = (frontMatter.customProps ?? {});
25
+ // Merge: parent category props + frontMatter props (frontMatter wins)
26
+ const customProps = { ...parentCustomProps, ...frontMatterCustomProps };
27
+ return { ...doc, customProps };
28
+ }
29
+ /**
30
+ Title can be declared inside md content or declared through
31
+ front matter and added manually. To make both cases consistent,
32
+ the added title is added under the same div.markdown block
33
+ See https://github.com/facebook/docusaurus/pull/4882#issuecomment-853021120
34
+
35
+ We render a "synthetic title" if:
36
+ - user doesn't ask to hide it with front matter
37
+ - the markdown content does not already contain a top-level h1 heading
38
+ */
39
+ function getSyntheticTitle(doc) {
40
+ const { metadata, frontMatter, contentTitle } = doc;
41
+ const shouldRender = !frontMatter.hide_title && typeof contentTitle === 'undefined';
42
+ if (!shouldRender) {
43
+ return null;
44
+ }
45
+ return metadata.title;
46
+ }
47
+ function DocItemContent({ children }) {
48
+ const doc = useDocWithCustomProps();
49
+ const syntheticTitle = getSyntheticTitle(doc);
50
+ const isPro = doc.customProps.plan === 'pro';
51
+ return ((0, jsx_runtime_1.jsxs)("div", { className: (0, clsx_1.default)(theme_common_1.ThemeClassNames.docs.docMarkdown, 'markdown'), children: [syntheticTitle && ((0, jsx_runtime_1.jsx)("header", { children: (0, jsx_runtime_1.jsx)(Heading_1.default, { as: "h1", children: syntheticTitle }) })), isPro && (0, jsx_runtime_1.jsx)(ProFeature_1.default, {}), (0, jsx_runtime_1.jsx)(MDXContent_1.default, { children: children })] }));
52
+ }
53
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/theme/DocItem/Content/index.tsx"],"names":[],"mappings":";;;;;AAiDA,iCAiBC;;AAjED,gDAAwB;AACxB,2DAAyD;AACzD,mEAA8D;AAC9D,6DAAqC;AACrC,mEAA2C;AAE3C,uFAAkF;AAElF,oFAA4D;AAE5D;;;GAGG;AACH,SAAS,qBAAqB;IAC5B,MAAM,GAAG,GAAG,IAAA,eAAM,GAAE,CAAC;IACrB,MAAM,iBAAiB,GAAG,IAAA,2DAA4B,GAAE,CAAC;IAEzD,8DAA8D;IAC9D,MAAM,WAAW,GAAG,GAAG,CAAC,WAAsC,CAAC;IAC/D,MAAM,sBAAsB,GAAG,CAAC,WAAW,CAAC,WAAW,IAAI,EAAE,CAAuB,CAAC;IAErF,sEAAsE;IACtE,MAAM,WAAW,GAAuB,EAAC,GAAG,iBAAiB,EAAE,GAAG,sBAAsB,EAAC,CAAC;IAE1F,OAAO,EAAC,GAAG,GAAG,EAAE,WAAW,EAAC,CAAC;AAC/B,CAAC;AAED;;;;;;;;;EASE;AACF,SAAS,iBAAiB,CAAC,GAA8B;IACvD,MAAM,EAAC,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAC,GAAG,GAAG,CAAC;IAClD,MAAM,YAAY,GAChB,CAAC,WAAW,CAAC,UAAU,IAAI,OAAO,YAAY,KAAK,WAAW,CAAC;IACjE,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,QAAQ,CAAC,KAAK,CAAC;AACxB,CAAC;AAED,SAAwB,cAAc,CAAC,EAAC,QAAQ,EAAQ;IACtD,MAAM,GAAG,GAAG,qBAAqB,EAAE,CAAC;IACpC,MAAM,cAAc,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC;IAE9C,MAAM,KAAK,GAAG,GAAG,CAAC,WAAW,CAAC,IAAI,KAAK,KAAK,CAAC;IAE7C,OAAO,CACL,iCAAK,SAAS,EAAE,IAAA,cAAI,EAAC,8BAAe,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,aAC/D,cAAc,IAAI,CACjB,6CACE,uBAAC,iBAAO,IAAC,EAAE,EAAC,IAAI,YAAE,cAAc,GAAW,GACpC,CACV,EACA,KAAK,IAAI,uBAAC,oBAAU,KAAG,EACxB,uBAAC,oBAAU,cAAE,QAAQ,GAAc,IAC/B,CACP,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widlarzgroup/docusaurus-ui",
3
- "version": "0.0.4",
3
+ "version": "0.1.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -21,7 +21,7 @@
21
21
  "scripts": {
22
22
  "swizzle": "docusaurus swizzle",
23
23
  "dev": "bun run build && tsc-watch -p tsconfig.build.json --onSuccess 'tsc-alias -p tsconfig.build.json && bun run copy-assets'",
24
- "build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && bun run copy-assets",
24
+ "build": "rm -rf lib && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && bun run copy-assets",
25
25
  "copy-assets": "find src -name '*.css' -exec sh -c 'mkdir -p lib/$(dirname ${1#src/}) && cp $1 lib/${1#src/}' _ {} \\;",
26
26
  "prepublishOnly": "bun run build"
27
27
  },
@@ -3,6 +3,6 @@
3
3
  align-items: center;
4
4
  justify-content: center;
5
5
  margin-left: 6px;
6
- color: #a855f7;
6
+ color: var(--color-pro, #B897FF);
7
7
  flex-shrink: 0;
8
8
  }
@@ -1,10 +1,53 @@
1
1
  .container {
2
+ position: relative;
2
3
  margin: 1.5rem 0;
3
- padding: 1.25rem 1.5rem;
4
- background: rgba(150, 201, 235, 0.08);
5
- border: 1px solid rgba(150, 201, 235, 0.2);
6
- border-left: 4px solid #96c9eb;
7
- border-radius: 8px;
4
+ padding: 1.5rem;
5
+ background:
6
+ /* Top-left subtle glow */
7
+ radial-gradient(ellipse 40% 50% at 15% 10%, color-mix(in srgb, var(--color-pro) 6%, transparent), transparent 50%),
8
+ /* Bottom-right accent */
9
+ radial-gradient(ellipse 35% 40% at 85% 90%, color-mix(in srgb, var(--color-pro) 4%, transparent), transparent 50%),
10
+ /* Base */
11
+ var(--color-bg-primary);
12
+ border: 1px solid var(--color-pro-border, color-mix(in srgb, var(--color-pro) 50%, transparent));
13
+ border-radius: 12px;
14
+ overflow: hidden;
15
+ }
16
+
17
+ /* Grid pattern - circular fade from top */
18
+ .container::before {
19
+ content: '';
20
+ position: absolute;
21
+ top: -52%;
22
+ left: 50%;
23
+ transform: translateX(-50%);
24
+ width: 160%;
25
+ height: 220%;
26
+ background:
27
+ linear-gradient(color-mix(in srgb, var(--color-pro) 7%, transparent) 1px, transparent 1px),
28
+ linear-gradient(90deg, color-mix(in srgb, var(--color-pro) 7%, transparent) 1px, transparent 1px);
29
+ background-size: 20px 20px;
30
+ mask-image: radial-gradient(ellipse 55% 45% at 50% 25%, black 0%, transparent 70%);
31
+ -webkit-mask-image: radial-gradient(ellipse 55% 45% at 50% 25%, black 0%, transparent 70%);
32
+ pointer-events: none;
33
+ }
34
+
35
+ /* Main glow accent - smaller, centered */
36
+ .container::after {
37
+ content: '';
38
+ position: absolute;
39
+ top: -30%;
40
+ left: 50%;
41
+ transform: translateX(-50%);
42
+ width: 50%;
43
+ height: 60%;
44
+ background: radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--color-pro-dim) 10%, transparent), transparent 70%);
45
+ pointer-events: none;
46
+ }
47
+
48
+ .content {
49
+ position: relative;
50
+ z-index: 1;
8
51
  }
9
52
 
10
53
  .header {
@@ -16,28 +59,25 @@
16
59
  .badge {
17
60
  display: inline-flex;
18
61
  align-items: center;
19
- gap: 0.4rem;
20
- padding: 0.3rem 0.6rem;
21
- background: linear-gradient(135deg, #96c9eb 0%, #76b8e5 100%);
22
- border-radius: 4px;
23
- }
24
-
25
- .icon {
26
- color: #171717;
62
+ gap: 0.5rem;
63
+ padding: 0.4rem 0.75rem;
64
+ background: color-mix(in srgb, var(--color-pro) 8%, transparent);
65
+ border: 1px solid var(--color-pro-border, color-mix(in srgb, var(--color-pro) 50%, transparent));
66
+ border-radius: 6px;
27
67
  }
28
68
 
29
69
  .badgeText {
30
70
  font-size: 0.75rem;
31
71
  font-weight: 700;
32
- color: #171717;
72
+ color: var(--color-pro);
33
73
  text-transform: uppercase;
34
- letter-spacing: 0.03em;
74
+ letter-spacing: 0.05em;
35
75
  }
36
76
 
37
77
  .description {
38
- margin: 0 0 1rem 0;
78
+ margin: 0 0 1.25rem 0;
39
79
  font-size: 0.9rem;
40
- color: var(--color-text-secondary, #b4b4b4);
80
+ color: var(--color-text-secondary);
41
81
  line-height: 1.6;
42
82
  }
43
83
 
@@ -50,40 +90,37 @@
50
90
  .primaryButton {
51
91
  display: inline-flex;
52
92
  align-items: center;
53
- padding: 0.5rem 1rem;
54
- background: #96c9eb;
55
- color: #171717;
56
- font-size: 0.85rem;
93
+ padding: 0.55rem 1.1rem;
94
+ background: transparent;
95
+ color: var(--color-pro) !important;
96
+ font-size: 0.8rem;
57
97
  font-weight: 600;
98
+ border-bottom: 1px solid var(--color-pro) !important;
58
99
  border-radius: 6px;
59
100
  text-decoration: none;
60
- transition: all 0.2s ease;
101
+ transition: all 0.15s ease;
61
102
  }
62
103
 
63
104
  .primaryButton:hover {
64
- background: #76b8e5;
65
- color: #171717;
105
+ opacity: 0.7;
66
106
  text-decoration: none;
67
107
  }
68
108
 
69
109
  .secondaryButton {
70
110
  display: inline-flex;
71
111
  align-items: center;
72
- padding: 0.5rem 1rem;
112
+ padding: 0.55rem 1.1rem;
73
113
  background: transparent;
74
- color: #96c9eb;
75
- font-size: 0.85rem;
76
- font-weight: 600;
77
- border: 1px solid rgba(150, 201, 235, 0.3);
114
+ color: var(--color-text-primary) !important;
115
+ font-size: 0.8rem;
116
+ font-weight: 500;
117
+ border-color: var(--color-text-primary) !important;
78
118
  border-radius: 6px;
79
119
  text-decoration: none;
80
- transition: all 0.2s ease;
120
+ transition: all 0.15s ease;
81
121
  }
82
122
 
83
123
  .secondaryButton:hover {
84
- background: rgba(150, 201, 235, 0.1);
85
- border-color: rgba(150, 201, 235, 0.5);
86
- color: #96c9eb;
124
+ opacity: 0.7;
87
125
  text-decoration: none;
88
126
  }
89
-
@@ -1,4 +1,6 @@
1
+ import Link from '@docusaurus/Link';
1
2
  import styles from './ProFeature.module.css';
3
+ import ProBadge from '@/components/ProBadge/ProBadge';
2
4
 
3
5
  interface ProFeatureProps {
4
6
  title?: string;
@@ -6,44 +8,34 @@ interface ProFeatureProps {
6
8
  }
7
9
 
8
10
  const ProFeature = ({
9
- title = 'Pro Feature',
10
- description = 'This feature is part of our commercial offering. Start a free trial to explore all Pro features.',
11
+ title = 'Pro Player Feature',
12
+ description = 'This feature is available exclusively in Pro Player. To access this functionality, please contact us.',
11
13
  }: ProFeatureProps) => {
12
14
  return (
13
15
  <div className={styles.container}>
14
- <div className={styles.header}>
15
- <div className={styles.badge}>
16
- <svg
17
- width="14"
18
- height="14"
19
- viewBox="0 0 24 24"
20
- fill="currentColor"
21
- className={styles.icon}
16
+ <div className={styles.content}>
17
+ <div className={styles.header}>
18
+ <div className={styles.badge}>
19
+ <ProBadge />
20
+ <span className={styles.badgeText}>{title}</span>
21
+ </div>
22
+ </div>
23
+ <p className={styles.description}>{description}</p>
24
+ <div className={styles.actions}>
25
+ <Link
26
+ to="https://thewidlarzgroup.com/?utm_source=docs&utm_medium=pro-feature&utm_campaign=pro-player#Contact"
27
+ className={styles.primaryButton}
28
+ >
29
+ Contact Us
30
+ </Link>
31
+ <Link
32
+ to="https://sdk.thewidlarzgroup.com/?utm_source=docs&utm_medium=pro-feature&utm_campaign=pro-player"
33
+ className={styles.secondaryButton}
22
34
  >
23
- <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" />
24
- </svg>
25
- <span className={styles.badgeText}>{title}</span>
35
+ Learn More
36
+ </Link>
26
37
  </div>
27
38
  </div>
28
- <p className={styles.description}>{description}</p>
29
- <div className={styles.actions}>
30
- <a
31
- href="https://sdk.thewidlarzgroup.com/signup?utm_source=rnv&utm_medium=docs&utm_campaign=pro-feature"
32
- target="_blank"
33
- rel="noreferrer"
34
- className={styles.primaryButton}
35
- >
36
- Start Free Trial
37
- </a>
38
- <a
39
- href="https://www.thewidlarzgroup.com/?utm_source=rnv&utm_medium=docs&utm_campaign=pro-feature#Contact"
40
- target="_blank"
41
- rel="noreferrer"
42
- className={styles.secondaryButton}
43
- >
44
- Contact Sales
45
- </a>
46
- </div>
47
39
  </div>
48
40
  );
49
41
  };
@@ -0,0 +1,63 @@
1
+ import type { PluginOptions } from '@docusaurus/plugin-content-docs';
2
+
3
+ type SidebarItemsGenerator = NonNullable<PluginOptions['sidebarItemsGenerator']>;
4
+ type GeneratorArgs = Parameters<SidebarItemsGenerator>[0];
5
+ type SidebarItem = Awaited<ReturnType<SidebarItemsGenerator>>[number];
6
+
7
+ /**
8
+ * Adds customProps from document frontmatter to sidebar items.
9
+ * This enables using customProps in .md files, not just _category_.json.
10
+ *
11
+ * @example
12
+ * // docusaurus.config.ts
13
+ * import { createSidebarWithCustomProps } from '@widlarzgroup/docusaurus-ui';
14
+ *
15
+ * export default {
16
+ * presets: [
17
+ * ['classic', {
18
+ * docs: {
19
+ * sidebarItemsGenerator: createSidebarWithCustomProps,
20
+ * },
21
+ * }],
22
+ * ],
23
+ * };
24
+ *
25
+ * // Then in your .md file:
26
+ * // ---
27
+ * // customProps:
28
+ * // badgeType: new
29
+ * // plan: pro
30
+ * // ---
31
+ */
32
+ export const createSidebarWithCustomProps: SidebarItemsGenerator = async ({
33
+ defaultSidebarItemsGenerator,
34
+ docs,
35
+ ...args
36
+ }: GeneratorArgs) => {
37
+ const sidebarItems = await defaultSidebarItemsGenerator({ docs, ...args });
38
+
39
+ function addCustomPropsFromFrontmatter(items: SidebarItem[]): SidebarItem[] {
40
+ return items.map((item) => {
41
+ if (item.type === 'category') {
42
+ return { ...item, items: addCustomPropsFromFrontmatter(item.items) };
43
+ }
44
+
45
+ // Only 'doc' type has id that matches docs array
46
+ if (item.type === 'doc') {
47
+ const doc = docs.find((d) => d.id === item.id);
48
+ const frontmatterCustomProps = doc?.frontMatter?.customProps;
49
+
50
+ if (frontmatterCustomProps && typeof frontmatterCustomProps === 'object') {
51
+ return {
52
+ ...item,
53
+ customProps: { ...item.customProps, ...frontmatterCustomProps },
54
+ };
55
+ }
56
+ }
57
+
58
+ return item;
59
+ });
60
+ }
61
+
62
+ return addCustomPropsFromFrontmatter(sidebarItems);
63
+ };
@@ -19,6 +19,12 @@
19
19
  --color-secondary-glow: rgba(232, 196, 32, 0.35);
20
20
  --color-secondary-subtle: rgba(232, 196, 32, 0.18);
21
21
 
22
+ --color-pro: #B897FF;
23
+ --color-pro-dim: #A07EF0;
24
+ --color-pro-glow: color-mix(in srgb, var(--color-pro) 25%, transparent);
25
+ --color-pro-subtle: color-mix(in srgb, var(--color-pro) 12%, transparent);
26
+ --color-pro-border: color-mix(in srgb, var(--color-pro) 85%, transparent);
27
+
22
28
  --color-text-primary: #1a1a1a;
23
29
  --color-text-secondary: #4a4a4a;
24
30
  --color-text-muted: #6a6a6a;
@@ -106,6 +112,12 @@
106
112
  --color-secondary-glow: rgba(250, 216, 91, 0.2);
107
113
  --color-secondary-subtle: rgba(250, 216, 91, 0.1);
108
114
 
115
+ --color-pro: #B897FF;
116
+ --color-pro-dim: #A07EF0;
117
+ --color-pro-glow: color-mix(in srgb, var(--color-pro) 20%, transparent);
118
+ --color-pro-subtle: color-mix(in srgb, var(--color-pro) 10%, transparent);
119
+ --color-pro-border: color-mix(in srgb, var(--color-pro) 20%, transparent);
120
+
109
121
  --color-text-primary: #e0e0e0;
110
122
  --color-text-secondary: #a0a0a0;
111
123
  --color-text-muted: #707070;
@@ -0,0 +1,31 @@
1
+ import {useSidebarBreadcrumbs} from '@docusaurus/plugin-content-docs/client';
2
+ import type {CustomSidebarProps} from '@/types/sidebar';
3
+
4
+ /**
5
+ * Returns merged customProps from all parent categories in the sidebar breadcrumb.
6
+ * Props from deeper categories override props from parent categories.
7
+ *
8
+ * @example
9
+ * // In a doc page component
10
+ * const { plan, badgeType } = useParentCategoryCustomProps();
11
+ *
12
+ * if (plan === 'pro') {
13
+ * // Show pro badge or restrict content
14
+ * }
15
+ */
16
+ export function useParentCategoryCustomProps(): CustomSidebarProps {
17
+ const breadcrumbs = useSidebarBreadcrumbs();
18
+
19
+ if (!breadcrumbs) {
20
+ return {};
21
+ }
22
+
23
+ // Merge customProps from all parent categories (excluding the current doc)
24
+ // Categories closer to the doc override parent categories
25
+ return breadcrumbs.reduce<CustomSidebarProps>((acc, item) => {
26
+ if (item.type === 'category' && item.customProps) {
27
+ return {...acc, ...item.customProps as CustomSidebarProps};
28
+ }
29
+ return acc;
30
+ }, {});
31
+ }
package/src/index.ts CHANGED
@@ -2,11 +2,14 @@ import path from 'path';
2
2
  import type { LoadContext, Plugin } from '@docusaurus/types';
3
3
 
4
4
  export default function themeDocusaurusUI(context: LoadContext): Plugin {
5
+ const isDev = process.env.NODE_ENV === 'development';
6
+
5
7
  return {
6
8
  name: '@widlarzgroup/docusaurus-ui',
7
9
 
8
10
  getThemePath() {
9
- return '../lib/theme';
11
+ // In dev mode, use source files directly for hot-reload
12
+ return isDev ? '../src/theme' : '../lib/theme';
10
13
  },
11
14
 
12
15
  getTypeScriptThemePath() {
@@ -16,7 +19,22 @@ export default function themeDocusaurusUI(context: LoadContext): Plugin {
16
19
  getClientModules() {
17
20
  return [path.resolve(__dirname, './css/custom.css')];
18
21
  },
22
+
23
+ // Configure webpack to handle TypeScript and path aliases from source
24
+ configureWebpack(config, isServer, utils) {
25
+ if (!isDev) return {};
26
+
27
+ return {
28
+ resolve: {
29
+ alias: {
30
+ // Resolve @/ imports to source directory
31
+ '@': path.resolve(__dirname, '../src'),
32
+ },
33
+ },
34
+ };
35
+ },
19
36
  };
20
37
  }
21
38
 
22
39
  export * from './types/sidebar';
40
+ export { createSidebarWithCustomProps } from './createSidebarWithCustomProps';
@@ -0,0 +1,67 @@
1
+ import React, {type ReactNode} from 'react';
2
+ import clsx from 'clsx';
3
+ import {ThemeClassNames} from '@docusaurus/theme-common';
4
+ import {useDoc} from '@docusaurus/plugin-content-docs/client';
5
+ import Heading from '@theme/Heading';
6
+ import MDXContent from '@theme/MDXContent';
7
+ import type {Props} from '@theme/DocItem/Content';
8
+ import {useParentCategoryCustomProps} from '@/hooks/useParentCategoryCustomProps';
9
+ import type {CustomSidebarProps} from '@/types/sidebar';
10
+ import ProFeature from '@/components/ProFeature/ProFeature';
11
+
12
+ /**
13
+ * Hook that returns doc data + merged customProps from parent categories and frontMatter.
14
+ * Document frontMatter takes precedence over parent category props.
15
+ */
16
+ function useDocWithCustomProps() {
17
+ const doc = useDoc();
18
+ const parentCustomProps = useParentCategoryCustomProps();
19
+
20
+ // frontMatter.customProps is not typed, so we need to cast it
21
+ const frontMatter = doc.frontMatter as Record<string, unknown>;
22
+ const frontMatterCustomProps = (frontMatter.customProps ?? {}) as CustomSidebarProps;
23
+
24
+ // Merge: parent category props + frontMatter props (frontMatter wins)
25
+ const customProps: CustomSidebarProps = {...parentCustomProps, ...frontMatterCustomProps};
26
+
27
+ return {...doc, customProps};
28
+ }
29
+
30
+ /**
31
+ Title can be declared inside md content or declared through
32
+ front matter and added manually. To make both cases consistent,
33
+ the added title is added under the same div.markdown block
34
+ See https://github.com/facebook/docusaurus/pull/4882#issuecomment-853021120
35
+
36
+ We render a "synthetic title" if:
37
+ - user doesn't ask to hide it with front matter
38
+ - the markdown content does not already contain a top-level h1 heading
39
+ */
40
+ function getSyntheticTitle(doc: ReturnType<typeof useDoc>): string | null {
41
+ const {metadata, frontMatter, contentTitle} = doc;
42
+ const shouldRender =
43
+ !frontMatter.hide_title && typeof contentTitle === 'undefined';
44
+ if (!shouldRender) {
45
+ return null;
46
+ }
47
+ return metadata.title;
48
+ }
49
+
50
+ export default function DocItemContent({children}: Props): ReactNode {
51
+ const doc = useDocWithCustomProps();
52
+ const syntheticTitle = getSyntheticTitle(doc);
53
+
54
+ const isPro = doc.customProps.plan === 'pro';
55
+
56
+ return (
57
+ <div className={clsx(ThemeClassNames.docs.docMarkdown, 'markdown')}>
58
+ {syntheticTitle && (
59
+ <header>
60
+ <Heading as="h1">{syntheticTitle}</Heading>
61
+ </header>
62
+ )}
63
+ {isPro && <ProFeature />}
64
+ <MDXContent>{children}</MDXContent>
65
+ </div>
66
+ );
67
+ }
@@ -1,3 +0,0 @@
1
- import { type ReactNode } from 'react';
2
- export default function DocItemTOCDesktop(): ReactNode;
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/theme/DocItem/TOC/Desktop/index.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAO5C,MAAM,CAAC,OAAO,UAAU,iBAAiB,IAAI,SAAS,CAarD"}
@@ -1,15 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.default = DocItemTOCDesktop;
7
- const jsx_runtime_1 = require("react/jsx-runtime");
8
- const theme_common_1 = require("@docusaurus/theme-common");
9
- const client_1 = require("@docusaurus/plugin-content-docs/client");
10
- const TOC_1 = __importDefault(require("@theme/TOC"));
11
- function DocItemTOCDesktop() {
12
- const { toc, frontMatter } = (0, client_1.useDoc)();
13
- return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(TOC_1.default, { toc: toc, minHeadingLevel: frontMatter.toc_min_heading_level, maxHeadingLevel: frontMatter.toc_max_heading_level, className: theme_common_1.ThemeClassNames.docs.docTocDesktop }) }));
14
- }
15
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/theme/DocItem/TOC/Desktop/index.tsx"],"names":[],"mappings":";;;;;AAOA,oCAaC;;AAnBD,2DAAyD;AACzD,mEAA8D;AAE9D,qDAA6B;AAG7B,SAAwB,iBAAiB;IACvC,MAAM,EAAC,GAAG,EAAE,WAAW,EAAC,GAAG,IAAA,eAAM,GAAE,CAAC;IACpC,OAAO,CACL,2DACE,uBAAC,aAAG,IACF,GAAG,EAAE,GAAG,EACR,eAAe,EAAE,WAAW,CAAC,qBAAqB,EAClD,eAAe,EAAE,WAAW,CAAC,qBAAqB,EAClD,SAAS,EAAE,8BAAe,CAAC,IAAI,CAAC,aAAa,GAC7C,GAED,CACJ,CAAC;AACJ,CAAC"}