BREAKING CHANGES: - Relationship syntax now requires blocks for all participants - Removed self/other perspective blocks from relationships - Replaced 'guard' keyword with 'if' for behavior tree decorators Language Features: - Add tree-sitter grammar with improved if/condition disambiguation - Add comprehensive tutorial and reference documentation - Add SBIR v0.2.0 binary format specification - Add resource linking system for behaviors and schedules - Add year-long schedule patterns (day, season, recurrence) - Add behavior tree enhancements (named nodes, decorators) Documentation: - Complete tutorial series (9 chapters) with baker family examples - Complete reference documentation for all language features - SBIR v0.2.0 specification with binary format details - Added locations and institutions documentation Examples: - Convert all examples to baker family scenario - Add comprehensive working examples Tooling: - Zed extension with LSP integration - Tree-sitter grammar for syntax highlighting - Build scripts and development tools Version Updates: - Main package: 0.1.0 → 0.2.0 - Tree-sitter grammar: 0.1.0 → 0.2.0 - Zed extension: 0.1.0 → 0.2.0 - Storybook editor: 0.1.0 → 0.2.0
71 lines
8.0 KiB
JavaScript
71 lines
8.0 KiB
JavaScript
// Populate the sidebar
|
|
//
|
|
// This is a script, and not included directly in the page, to control the total size of the book.
|
|
// The TOC contains an entry for each page, so if each page includes a copy of the TOC,
|
|
// the total size of the page becomes O(n**2).
|
|
class MDBookSidebarScrollbox extends HTMLElement {
|
|
constructor() {
|
|
super();
|
|
}
|
|
connectedCallback() {
|
|
this.innerHTML = '<ol class="chapter"><li class="chapter-item expanded affix "><a href="index.html">Introduction</a></li><li class="chapter-item expanded affix "><li class="spacer"></li><li class="chapter-item expanded affix "><li class="part-title">Part I: Getting Started</li><li class="chapter-item expanded "><a href="tutorial/01-welcome.html"><strong aria-hidden="true">1.</strong> Welcome to Storybook</a></li><li class="chapter-item expanded "><a href="tutorial/02-creating-characters.html"><strong aria-hidden="true">2.</strong> Creating Characters</a></li><li class="chapter-item expanded "><a href="tutorial/03-first-behavior-tree.html"><strong aria-hidden="true">3.</strong> Your First Behavior Tree</a></li><li class="chapter-item expanded "><a href="tutorial/04-making-characters-act.html"><strong aria-hidden="true">4.</strong> Making Characters Act</a></li><li class="chapter-item expanded "><a href="tutorial/05-advanced-behaviors.html"><strong aria-hidden="true">5.</strong> Advanced Behaviors</a></li><li class="chapter-item expanded "><a href="tutorial/06-relationships.html"><strong aria-hidden="true">6.</strong> Character Relationships</a></li><li class="chapter-item expanded "><a href="tutorial/07-schedules.html"><strong aria-hidden="true">7.</strong> Schedules and Time</a></li><li class="chapter-item expanded "><a href="tutorial/08-life-arcs.html"><strong aria-hidden="true">8.</strong> Life Arcs</a></li><li class="chapter-item expanded "><a href="tutorial/09-locations-institutions.html"><strong aria-hidden="true">9.</strong> Locations and Institutions</a></li><li class="chapter-item expanded affix "><li class="spacer"></li><li class="chapter-item expanded affix "><li class="part-title">Part II: Complete Reference</li><li class="chapter-item expanded "><a href="reference/09-overview.html"><strong aria-hidden="true">10.</strong> Language Overview</a></li><li class="chapter-item expanded "><a href="reference/10-characters.html"><strong aria-hidden="true">11.</strong> Characters</a></li><li class="chapter-item expanded "><a href="reference/11-behavior-trees.html"><strong aria-hidden="true">12.</strong> Behavior Trees</a></li><li class="chapter-item expanded "><a href="reference/12-decorators.html"><strong aria-hidden="true">13.</strong> Decorators</a></li><li class="chapter-item expanded "><a href="reference/13-life-arcs.html"><strong aria-hidden="true">14.</strong> Life Arcs</a></li><li class="chapter-item expanded "><a href="reference/14-schedules.html"><strong aria-hidden="true">15.</strong> Schedules</a></li><li class="chapter-item expanded "><a href="reference/15-relationships.html"><strong aria-hidden="true">16.</strong> Relationships</a></li><li class="chapter-item expanded "><a href="reference/16a-locations.html"><strong aria-hidden="true">17.</strong> Locations</a></li><li class="chapter-item expanded "><a href="reference/16b-institutions.html"><strong aria-hidden="true">18.</strong> Institutions</a></li><li class="chapter-item expanded "><a href="reference/16-other-declarations.html"><strong aria-hidden="true">19.</strong> Other Declarations</a></li><li class="chapter-item expanded "><a href="reference/17-expressions.html"><strong aria-hidden="true">20.</strong> Expression Language</a></li><li class="chapter-item expanded "><a href="reference/18-value-types.html"><strong aria-hidden="true">21.</strong> Value Types</a></li><li class="chapter-item expanded "><a href="reference/19-validation.html"><strong aria-hidden="true">22.</strong> Validation Rules</a></li><li class="chapter-item expanded affix "><li class="spacer"></li><li class="chapter-item expanded affix "><li class="part-title">Part III: Advanced Topics</li><li class="chapter-item expanded "><a href="advanced/20-patterns.html"><strong aria-hidden="true">23.</strong> Design Patterns</a></li><li class="chapter-item expanded "><a href="advanced/21-sbir-format.html"><strong aria-hidden="true">24.</strong> The SBIR Binary Format</a></li><li class="chapter-item expanded "><a href="advanced/22-integration.html"><strong aria-hidden="true">25.</strong> Integration Guide</a></li><li class="chapter-item expanded "><a href="advanced/23-best-practices.html"><strong aria-hidden="true">26.</strong> Best Practices</a></li><li class="chapter-item expanded affix "><li class="spacer"></li><li class="chapter-item expanded affix "><li class="part-title">Part IV: Examples Gallery</li><li class="chapter-item expanded "><a href="examples/24-baker-family-complete.html"><strong aria-hidden="true">27.</strong> Baker Family Complete</a></li><li class="chapter-item expanded "><a href="examples/25-day-in-life.html"><strong aria-hidden="true">28.</strong> Day in the Life</a></li><li class="chapter-item expanded "><a href="examples/26-character-evolution.html"><strong aria-hidden="true">29.</strong> Character Evolution</a></li><li class="chapter-item expanded "><a href="examples/27-multi-character.html"><strong aria-hidden="true">30.</strong> Multi-Character Interactions</a></li></ol>';
|
|
// Set the current, active page, and reveal it if it's hidden
|
|
let current_page = document.location.href.toString();
|
|
if (current_page.endsWith("/")) {
|
|
current_page += "index.html";
|
|
}
|
|
var links = Array.prototype.slice.call(this.querySelectorAll("a"));
|
|
var l = links.length;
|
|
for (var i = 0; i < l; ++i) {
|
|
var link = links[i];
|
|
var href = link.getAttribute("href");
|
|
if (href && !href.startsWith("#") && !/^(?:[a-z+]+:)?\/\//.test(href)) {
|
|
link.href = path_to_root + href;
|
|
}
|
|
// The "index" page is supposed to alias the first chapter in the book.
|
|
if (link.href === current_page || (i === 0 && path_to_root === "" && current_page.endsWith("/index.html"))) {
|
|
link.classList.add("active");
|
|
var parent = link.parentElement;
|
|
if (parent && parent.classList.contains("chapter-item")) {
|
|
parent.classList.add("expanded");
|
|
}
|
|
while (parent) {
|
|
if (parent.tagName === "LI" && parent.previousElementSibling) {
|
|
if (parent.previousElementSibling.classList.contains("chapter-item")) {
|
|
parent.previousElementSibling.classList.add("expanded");
|
|
}
|
|
}
|
|
parent = parent.parentElement;
|
|
}
|
|
}
|
|
}
|
|
// Track and set sidebar scroll position
|
|
this.addEventListener('click', function(e) {
|
|
if (e.target.tagName === 'A') {
|
|
sessionStorage.setItem('sidebar-scroll', this.scrollTop);
|
|
}
|
|
}, { passive: true });
|
|
var sidebarScrollTop = sessionStorage.getItem('sidebar-scroll');
|
|
sessionStorage.removeItem('sidebar-scroll');
|
|
if (sidebarScrollTop) {
|
|
// preserve sidebar scroll position when navigating via links within sidebar
|
|
this.scrollTop = sidebarScrollTop;
|
|
} else {
|
|
// scroll sidebar to current active section when navigating via "next/previous chapter" buttons
|
|
var activeSection = document.querySelector('#sidebar .active');
|
|
if (activeSection) {
|
|
activeSection.scrollIntoView({ block: 'center' });
|
|
}
|
|
}
|
|
// Toggle buttons
|
|
var sidebarAnchorToggles = document.querySelectorAll('#sidebar a.toggle');
|
|
function toggleSection(ev) {
|
|
ev.currentTarget.parentElement.classList.toggle('expanded');
|
|
}
|
|
Array.from(sidebarAnchorToggles).forEach(function (el) {
|
|
el.addEventListener('click', toggleSection);
|
|
});
|
|
}
|
|
}
|
|
window.customElements.define("mdbook-sidebar-scrollbox", MDBookSidebarScrollbox);
|