Feat/optimize naming (#2)

* Refactor project name from "Open Claude Design" to "Open Design"

- Updated project name in package.json, package-lock.json, and README files.
- Changed CLI commands and references from "ocd" to "od".
- Adjusted file structure references in documentation and code to reflect new naming conventions.
- Enhanced .gitignore to include new runtime data files.
- Updated metadata in LICENSE file to match new project name.

* Add contributing guidelines in English and Chinese

- Introduced CONTRIBUTING.md and CONTRIBUTING.zh-CN.md to provide clear instructions for contributors.
- Outlined contribution types, local setup instructions, and merging criteria for skills and design systems.
- Enhanced README files to reference the new contributing guidelines.

* Update README and documentation for deck framework directives

- Clarified DECK_FRAMEWORK_DIRECTIVE description in both English and Chinese README files to specify conditions for deck kind without a skill seed.
- Added detailed workflow instructions in deck-framework.ts to emphasize the importance of copying the framework before adding content.
- Enhanced discovery.ts to reinforce the framework-first approach for deck projects.
- Updated system.ts to ensure proper handling of deck projects with and without bound skills, preventing re-authorship of scaling and navigation logic.

* Update README and documentation for deck framework directives

- Clarified DECK_FRAMEWORK_DIRECTIVE description in both English and Chinese README files to specify conditions for deck kind without a skill seed.
- Added detailed workflow instructions in deck-framework.ts to emphasize the importance of copying the framework before adding content.
- Enhanced discovery.ts to reinforce the framework-first approach for deck projects.
- Updated system.ts to ensure proper handling of deck projects with and without bound skills, preventing re-authorship of scaling and navigation logic.
This commit is contained in:
Tom Huang
2026-04-28 16:28:19 +08:00
committed by GitHub
parent 6f6bf31dd2
commit bc2198103a
9 changed files with 135 additions and 80 deletions
+11 -8
View File
@@ -16,10 +16,10 @@
*/
export function buildSrcdoc(
html: string,
options: { deck?: boolean } = {},
options: { deck?: boolean } = {}
): string {
const head = html.trimStart().slice(0, 64).toLowerCase();
const isFullDoc = head.startsWith('<!doctype') || head.startsWith('<html');
const isFullDoc = head.startsWith("<!doctype") || head.startsWith("<html");
const wrapped = isFullDoc
? html
: `<!doctype html>
@@ -68,8 +68,10 @@ function injectSandboxShim(doc: string): string {
tryShim('localStorage');
tryShim('sessionStorage');
})();</script>`;
if (/<head[^>]*>/i.test(doc)) return doc.replace(/<head[^>]*>/i, (m) => `${m}${shim}`);
if (/<body[^>]*>/i.test(doc)) return doc.replace(/<body[^>]*>/i, (m) => `${m}${shim}`);
if (/<head[^>]*>/i.test(doc))
return doc.replace(/<head[^>]*>/i, (m) => `${m}${shim}`);
if (/<body[^>]*>/i.test(doc))
return doc.replace(/<body[^>]*>/i, (m) => `${m}${shim}`);
return shim + doc;
}
@@ -101,10 +103,10 @@ function injectDeckBridge(doc: string): string {
.stage, .deck-stage, .deck-shell { place-content: center !important; }
</style>`;
const docWithStyle = /<\/head>/i.test(doc)
? doc.replace(/<\/head>/i, styleFix + '</head>')
? doc.replace(/<\/head>/i, styleFix + "</head>")
: /<head[^>]*>/i.test(doc)
? doc.replace(/<head[^>]*>/i, (m) => m + styleFix)
: styleFix + doc;
? doc.replace(/<head[^>]*>/i, (m) => m + styleFix)
: styleFix + doc;
doc = docWithStyle;
const script = `<script>(function(){
function slides(){ return document.querySelectorAll('.slide'); }
@@ -265,6 +267,7 @@ function injectDeckBridge(doc: string): string {
}
observeSlides();
})();</script>`;
if (/<\/body>/i.test(doc)) return doc.replace(/<\/body>/i, `${script}</body>`);
if (/<\/body>/i.test(doc))
return doc.replace(/<\/body>/i, `${script}</body>`);
return doc + script;
}