@puzzmo/sdk 1.0.34 → 1.0.36

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.
@@ -1,4 +1,4 @@
1
- import { t as e } from "../createSimulator-CxuhQLO3.js";
1
+ import { t as e } from "../createSimulator-93lwHvfg.js";
2
2
  /**
3
3
  * Standalone entry point for the simulator.
4
4
  *
@@ -1,5 +1,5 @@
1
1
  import type { HostContext, ThumbnailConfig } from "../types";
2
- import type { SimulatorConfig, SimulatorState, TabName } from "./types";
2
+ import type { PreviewKind, SimulatorConfig, SimulatorState, TabName } from "./types";
3
3
  export declare function persistHostContext(hostContext: HostContext[]): void;
4
4
  export declare function clearHostContext(): void;
5
5
  export declare function createInitialState(config: SimulatorConfig, fixtureCategories: string[], validTabIds: string[]): SimulatorState;
@@ -12,5 +12,6 @@ export declare function persistFixtureCategory(category: string): void;
12
12
  export declare function persistFixturePuzzle(puzzle: string): void;
13
13
  export declare function clearFixturePuzzle(): void;
14
14
  export declare function persistRenderHost(host: ThumbnailConfig["renderHost"]): void;
15
+ export declare function persistPreviewKind(kind: PreviewKind): void;
15
16
  export declare function persistRenderContext(context: ThumbnailConfig["renderContext"]): void;
16
17
  //# sourceMappingURL=state.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/simulator/state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAS,eAAe,EAAE,MAAM,UAAU,CAAA;AAEnE,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AA2BvE,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,WAAW,EAAE,GAAG,IAAI,CAEnE;AAED,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC;AAuDD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,MAA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AE,GAAG,CAAC,GAAG,IAAI,CAEvE;AAED,wBAAgB,iBAAiB,IAAI,IAAI,CAExC;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CAEzD;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAE7C;AAED,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAEpD;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAE7D;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEzD;AAED,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,eAAe,CAAC,YAAY,CAAC,GAAG,IAAI,CAM3E;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAE1D;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,eAAe,CAAC,eAAe,CAAC,GAAG,IAAI,CAMpF"}
@@ -1,2 +1,2 @@
1
- export declare const simulatorStyles = "\n :root {\n --sim-bg: #1a1a2e;\n --sim-bg-alt: #16213e;\n --sim-panel: #0f0f1a;\n --sim-border: #3a3a5c;\n --sim-border-light: #5a5a8c;\n --sim-accent: #ffd700;\n --sim-accent-hover: #ffed4a;\n --sim-text: #e8e8e8;\n --sim-text-dim: #888899;\n --sim-success: #4ade80;\n --sim-error: #f87171;\n --sim-warning: #fbbf24;\n --sim-blue: #60a5fa;\n }\n #simulator {\n position: fixed;\n bottom: 4px;\n left: 4px;\n z-index: 999999;\n font: 11px/1.4 \"Menlo\", \"Monaco\", \"Consolas\", monospace;\n user-select: none;\n }\n #simulator-panel {\n background: var(--sim-panel);\n border: 2px solid var(--sim-border);\n border-radius: 4px;\n color: var(--sim-text);\n width: 420px;\n max-width: calc(100vw - 8px);\n box-shadow: 4px 4px 0 rgba(0,0,0,0.5);\n }\n #simulator-panel.collapsed {\n width: auto;\n }\n #simulator-header {\n display: flex;\n align-items: center;\n padding: 4px 8px;\n background: var(--sim-bg);\n border-bottom: 2px solid var(--sim-border);\n gap: 0;\n }\n #simulator-panel.collapsed #simulator-header {\n border-bottom: none;\n cursor: pointer;\n }\n #simulator-panel.collapsed #simulator-header:hover {\n background: var(--sim-bg-alt);\n }\n .header-sep {\n color: var(--sim-border-light);\n margin: 0 8px;\n opacity: 0.6;\n }\n .header-spacer {\n flex: 1;\n }\n #simulator-title {\n color: var(--sim-accent);\n text-transform: uppercase;\n letter-spacing: 1px;\n font-size: 10px;\n font-weight: bold;\n }\n #simulator-header-controls {\n display: flex;\n gap: 2px;\n }\n .header-icon-btn {\n width: 20px;\n height: 20px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: transparent;\n border: none;\n border-radius: 2px;\n color: var(--sim-text);\n cursor: pointer;\n padding: 0;\n }\n .header-icon-btn:hover:not(:disabled) {\n background: var(--sim-border);\n color: var(--sim-accent);\n }\n .header-icon-btn:disabled {\n opacity: 0.3;\n cursor: not-allowed;\n }\n .header-icon-btn.active {\n background: var(--sim-accent);\n color: var(--sim-panel);\n }\n #simulator-header-status {\n display: flex;\n align-items: center;\n gap: 4px;\n font-size: 9px;\n color: var(--sim-text-dim);\n }\n #simulator-header-indicator {\n width: 6px;\n height: 6px;\n border-radius: 50%;\n background: var(--sim-text-dim);\n flex-shrink: 0;\n }\n #simulator-header-indicator.ready {\n background: var(--sim-success);\n box-shadow: 0 0 4px var(--sim-success);\n }\n #simulator-header-indicator.waiting {\n background: var(--sim-warning);\n box-shadow: 0 0 4px var(--sim-warning);\n }\n #simulator-header-indicator.paused {\n background: var(--sim-error);\n box-shadow: 0 0 4px var(--sim-error);\n }\n #simulator-header-indicator.complete {\n background: transparent;\n box-shadow: none;\n color: var(--sim-success);\n width: auto;\n height: auto;\n font-size: 11px;\n line-height: 1;\n font-weight: bold;\n }\n #simulator-timer {\n font-size: 11px;\n color: var(--sim-text);\n font-family: \"Menlo\", monospace;\n font-weight: bold;\n font-variant-numeric: tabular-nums;\n min-width: 38px;\n }\n #simulator-timer .penalty {\n color: var(--sim-error);\n margin-left: 2px;\n }\n /* Collapsed state - show minimal bar */\n #simulator-panel.collapsed .header-sep,\n #simulator-panel.collapsed #simulator-header-controls,\n #simulator-panel.collapsed #simulator-header-status,\n #simulator-panel.collapsed #simulator-header-settings,\n #simulator-panel.collapsed #simulator-toggle {\n display: none;\n }\n #simulator-panel.collapsed #simulator-title {\n cursor: pointer;\n }\n #simulator-panel.collapsed #simulator-timer {\n margin-left: 8px;\n }\n #simulator-body {\n display: flex;\n flex-direction: row;\n }\n #simulator-panel.collapsed #simulator-body {\n display: none;\n }\n #simulator-tabs {\n display: flex;\n flex-direction: column;\n background: var(--sim-bg);\n padding: 4px;\n gap: 2px;\n border-right: 2px solid var(--sim-border);\n }\n .simulator-tab {\n padding: 2px 3px;\n background: var(--sim-bg-alt);\n border: 2px solid var(--sim-border);\n border-radius: 2px;\n color: var(--sim-text-dim);\n cursor: pointer;\n font: inherit;\n text-transform: uppercase;\n font-size: 9px;\n font-weight: bold;\n letter-spacing: 0.5px;\n min-height: 0;\n }\n .simulator-tab:hover {\n color: var(--sim-text);\n background: var(--sim-border);\n }\n .simulator-tab.active {\n color: var(--sim-panel);\n background: var(--sim-accent);\n border-color: var(--sim-accent);\n }\n .simulator-tab {\n position: relative;\n }\n .simulator-tab-badge {\n position: absolute;\n top: -4px;\n right: -4px;\n min-width: 14px;\n height: 14px;\n padding: 0 3px;\n background: var(--sim-blue);\n color: #fff;\n font-size: 8px;\n font-weight: bold;\n border-radius: 7px;\n display: flex;\n align-items: center;\n justify-content: center;\n box-shadow: 0 1px 2px rgba(0,0,0,0.3);\n line-height: 1;\n text-align: center;\n box-sizing: border-box;\n }\n .simulator-tab-badge:empty {\n display: none;\n }\n #simulator-content {\n padding: 6px;\n background: var(--sim-panel);\n height: 500px;\n flex: 1;\n overflow-y: auto;\n }\n #simulator-content.hidden {\n display: none;\n }\n #simulator-content::-webkit-scrollbar {\n width: 8px;\n }\n #simulator-content::-webkit-scrollbar-track {\n background: var(--sim-bg);\n }\n #simulator-content::-webkit-scrollbar-thumb {\n background: var(--sim-border);\n border-radius: 2px;\n }\n .simulator-btn {\n padding: 4px 8px;\n background: var(--sim-bg-alt);\n border: 2px solid var(--sim-border);\n border-radius: 2px;\n color: var(--sim-text);\n font: inherit;\n font-size: 10px;\n font-weight: bold;\n text-transform: uppercase;\n letter-spacing: 1px;\n cursor: pointer;\n }\n .simulator-btn:hover {\n background: var(--sim-border);\n border-color: var(--sim-border-light);\n }\n .simulator-btn:active {\n transform: translate(1px, 1px);\n }\n .simulator-btn.primary {\n background: var(--sim-accent);\n border-color: var(--sim-accent);\n color: var(--sim-panel);\n }\n .simulator-btn.primary:hover {\n background: var(--sim-accent-hover);\n border-color: var(--sim-accent-hover);\n }\n .simulator-btn.danger {\n background: var(--sim-error);\n border-color: var(--sim-error);\n color: #fff;\n }\n .simulator-btn.danger:hover {\n background: #ef4444;\n border-color: #ef4444;\n }\n .simulator-btn:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n transform: none;\n }\n .simulator-btn.subtle {\n background: transparent;\n border-color: transparent;\n color: var(--sim-text-dim);\n }\n .simulator-btn.subtle:hover:not(:disabled) {\n background: var(--sim-bg-alt);\n border-color: var(--sim-border);\n color: var(--sim-text);\n }\n #simulator-status {\n font-size: 10px;\n color: var(--sim-text-dim);\n padding: 4px 0 6px;\n display: flex;\n align-items: center;\n gap: 6px;\n }\n #simulator-status .indicator {\n width: 8px;\n height: 8px;\n border-radius: 2px;\n background: var(--sim-text-dim);\n }\n #simulator-status .indicator.ready {\n background: var(--sim-success);\n box-shadow: 0 0 6px var(--sim-success);\n }\n #simulator-status .indicator.waiting {\n background: var(--sim-warning);\n box-shadow: 0 0 6px var(--sim-warning);\n }\n #simulator-status .indicator.paused {\n background: var(--sim-error);\n box-shadow: 0 0 6px var(--sim-error);\n }\n #simulator-status .indicator.complete {\n background: transparent;\n box-shadow: none;\n color: var(--sim-success);\n width: auto;\n height: auto;\n font-size: 12px;\n line-height: 1;\n font-weight: bold;\n }\n .simulator-row {\n display: flex;\n gap: 4px;\n margin-top: 4px;\n }\n .simulator-row .simulator-btn {\n flex: 1;\n }\n .simulator-divider {\n height: 2px;\n background: var(--sim-border);\n margin: 8px 0;\n }\n .simulator-field {\n margin-bottom: 6px;\n }\n .simulator-select {\n width: 100%;\n padding: 4px 6px;\n background: var(--sim-bg);\n border: 2px solid var(--sim-border);\n border-radius: 2px;\n color: var(--sim-text);\n font: inherit;\n font-size: 10px;\n cursor: pointer;\n }\n .simulator-select:focus {\n outline: none;\n border-color: var(--sim-accent);\n }\n .simulator-select option {\n background: var(--sim-bg);\n color: var(--sim-text);\n }\n .simulator-fixtures {\n margin-bottom: 8px;\n padding-bottom: 8px;\n border-bottom: 2px solid var(--sim-border);\n }\n .simulator-label {\n display: block;\n color: var(--sim-accent);\n text-transform: uppercase;\n font-size: 9px;\n font-weight: bold;\n letter-spacing: 1px;\n margin-bottom: 4px;\n }\n .simulator-textarea {\n width: 100%;\n min-height: 40px;\n background: var(--sim-bg);\n border: 2px solid var(--sim-border);\n border-radius: 2px;\n color: var(--sim-text);\n font: 10px/1.4 \"Menlo\", monospace;\n padding: 4px;\n resize: none;\n box-sizing: border-box;\n overflow-y: auto;\n }\n .simulator-textarea.auto-resize {\n resize: none;\n overflow-y: auto;\n }\n .simulator-textarea:focus {\n outline: none;\n border-color: var(--sim-accent);\n }\n .simulator-input {\n width: 100%;\n background: var(--sim-bg);\n border: 2px solid var(--sim-border);\n border-radius: 2px;\n color: var(--sim-text);\n font: 10px/1.4 \"Menlo\", monospace;\n padding: 4px 6px;\n box-sizing: border-box;\n }\n .simulator-input:focus {\n outline: none;\n border-color: var(--sim-accent);\n }\n .simulator-input::placeholder {\n color: var(--sim-text-dim);\n }\n .simulator-tab-content {\n display: none;\n }\n .simulator-tab-content.active {\n display: block;\n }\n .msgs-view-container {\n display: flex;\n flex-direction: column;\n height: 100%;\n overflow: hidden;\n }\n .msgs-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 6px;\n flex-shrink: 0;\n }\n #simulator-msgs-log {\n display: flex;\n flex-direction: column;\n gap: 2px;\n flex: 1;\n overflow-y: auto;\n }\n .simulator-msg {\n padding: 3px 4px;\n background: var(--sim-bg);\n border: 1px solid var(--sim-border);\n border-radius: 2px;\n font-size: 10px;\n }\n .simulator-msg.out {\n border-left: 2px solid var(--sim-accent);\n }\n .simulator-msg.in {\n border-left: 2px solid var(--sim-blue);\n }\n .simulator-msg-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 2px;\n }\n .simulator-msg-type {\n font-weight: bold;\n color: var(--sim-text);\n }\n .simulator-msg.out .simulator-msg-type {\n color: var(--sim-accent);\n }\n .simulator-msg.in .simulator-msg-type {\n color: var(--sim-blue);\n }\n .simulator-msg-time {\n color: var(--sim-text-dim);\n font-size: 9px;\n }\n .simulator-msg-data {\n color: var(--sim-text-dim);\n font-size: 9px;\n white-space: pre-wrap;\n word-break: break-all;\n max-height: 60px;\n overflow: hidden;\n cursor: pointer;\n border-radius: 2px;\n padding: 2px 4px;\n background: var(--sim-bg-alt);\n }\n .simulator-msg-data:hover {\n background: var(--sim-border);\n }\n .simulator-msg.expanded {\n flex: 1;\n display: flex;\n flex-direction: column;\n }\n .simulator-msg.expanded .simulator-msg-data {\n max-height: none;\n flex: 1;\n overflow-y: auto;\n }\n .simulator-empty {\n color: var(--sim-text-dim);\n font-size: 10px;\n text-align: center;\n padding: 20px;\n }\n .simulator-value {\n color: var(--sim-text);\n font-size: 10px;\n padding: 4px;\n background: var(--sim-bg);\n border: 1px solid var(--sim-border);\n border-radius: 2px;\n }\n .simulator-deeds {\n display: flex;\n flex-direction: column;\n gap: 2px;\n }\n .simulator-deed {\n display: flex;\n justify-content: space-between;\n padding: 3px 4px;\n background: var(--sim-bg);\n border: 1px solid var(--sim-border);\n border-radius: 2px;\n font-size: 10px;\n }\n .simulator-deed-name {\n color: var(--sim-text);\n }\n .simulator-deed-value {\n color: var(--sim-accent);\n font-weight: bold;\n }\n .thumb-view-container {\n display: flex;\n flex-direction: column;\n height: 100%;\n overflow: hidden;\n }\n .thumb-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 6px;\n flex-shrink: 0;\n }\n #simulator-thumb-preview {\n background: var(--sim-thumb-bg, transparent);\n border: 2px solid var(--sim-border);\n border-radius: 2px;\n padding: 8px;\n display: flex;\n align-items: center;\n justify-content: center;\n aspect-ratio: 1;\n width: 100%;\n box-sizing: border-box;\n }\n #simulator-thumb-preview svg {\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n }\n #simulator-thumb-fn {\n font-size: 10px;\n color: var(--sim-text-dim);\n margin-top: 4px;\n }\n .theme-view-container {\n display: flex;\n flex-direction: column;\n height: 100%;\n overflow: hidden;\n }\n .theme-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 6px;\n flex-shrink: 0;\n }\n .simulator-themes {\n display: flex;\n flex-direction: column;\n gap: 4px;\n flex: 1;\n overflow-y: auto;\n }\n .simulator-theme-item {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 4px;\n background: var(--sim-bg);\n border: 2px solid var(--sim-border);\n border-radius: 2px;\n cursor: pointer;\n }\n .simulator-theme-item:hover {\n border-color: var(--sim-border-light);\n }\n .simulator-theme-item.selected {\n border-color: var(--sim-accent);\n background: var(--sim-bg-alt);\n }\n .simulator-theme-preview {\n width: 48px;\n height: 32px;\n display: grid;\n grid-template-columns: repeat(3, 1fr);\n grid-template-rows: repeat(2, 1fr);\n gap: 1px;\n border-radius: 2px;\n overflow: hidden;\n flex-shrink: 0;\n }\n .simulator-theme-preview-cell {\n width: 100%;\n height: 100%;\n }\n .simulator-theme-name {\n font-size: 10px;\n color: var(--sim-text);\n flex: 1;\n }\n .simulator-theme-type {\n font-size: 9px;\n color: var(--sim-text-dim);\n text-transform: uppercase;\n }\n /* Auth tab styles */\n .simulator-section {\n margin-bottom: 12px;\n }\n .simulator-section-title {\n color: var(--sim-accent);\n text-transform: uppercase;\n font-size: 10px;\n font-weight: bold;\n letter-spacing: 1px;\n margin-bottom: 6px;\n padding-bottom: 4px;\n border-bottom: 1px solid var(--sim-border);\n }\n .auth-header-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 6px;\n }\n .auth-status {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 10px;\n color: var(--sim-text-dim);\n padding: 4px 0;\n }\n .auth-status.authenticated {\n color: var(--sim-success);\n }\n .simulator-btn.small {\n padding: 2px 6px;\n font-size: 9px;\n }\n .simulator-btn.tiny {\n padding: 3px 2px;\n font-size: 8px;\n border-width: 1px;\n line-height: 1;\n min-height: 0;\n height: auto;\n }\n .auth-title-row {\n display: flex;\n align-items: center;\n gap: 6px;\n }\n .auth-title-row > span:first-child {\n flex: 1;\n }\n .auth-title-row .simulator-btn.active {\n background: var(--sim-accent);\n color: black;\n }\n .auth-description {\n font-size: 10px;\n color: var(--sim-text-dim);\n margin: 6px 0;\n line-height: 1.4;\n }\n .auth-user-info {\n font-size: 10px;\n color: var(--sim-text-dim);\n padding: 6px;\n background: var(--sim-bg);\n border: 1px solid var(--sim-border);\n border-radius: 2px;\n margin-bottom: 8px;\n }\n .auth-user-info div {\n margin-bottom: 4px;\n }\n .auth-user-info div:last-child {\n margin-bottom: 0;\n }\n .auth-user-info code {\n color: var(--sim-text);\n background: var(--sim-bg-alt);\n padding: 1px 4px;\n border-radius: 2px;\n }\n .auth-warning {\n color: var(--sim-warning);\n font-style: italic;\n }\n .auth-error {\n margin-top: 8px;\n }\n .auth-error .error,\n .auth-api-result .error {\n color: var(--sim-error);\n font-size: 10px;\n padding: 6px;\n background: rgba(248, 113, 113, 0.1);\n border: 1px solid var(--sim-error);\n border-radius: 2px;\n }\n .auth-api-result {\n margin-top: 8px;\n }\n .auth-api-result pre {\n font-size: 9px;\n color: var(--sim-text);\n background: var(--sim-bg);\n border: 1px solid var(--sim-border);\n border-radius: 2px;\n padding: 6px;\n margin: 0;\n white-space: pre-wrap;\n word-break: break-all;\n max-height: 150px;\n overflow-y: auto;\n }\n .auth-api-result .loading {\n font-size: 10px;\n color: var(--sim-text-dim);\n padding: 6px;\n background: var(--sim-bg);\n border: 1px solid var(--sim-border);\n border-radius: 2px;\n }\n /* Data view styles */\n .data-view-container {\n display: flex;\n flex-direction: column;\n height: 100%;\n overflow: hidden;\n }\n .data-subtabs {\n display: flex;\n gap: 2px;\n margin-bottom: 8px;\n flex-shrink: 0;\n }\n .data-subtab {\n padding: 4px 10px;\n background: var(--sim-bg-alt);\n border: 1px solid var(--sim-border);\n border-radius: 2px;\n color: var(--sim-text-dim);\n cursor: pointer;\n font: inherit;\n font-size: 9px;\n font-weight: bold;\n text-transform: uppercase;\n letter-spacing: 0.5px;\n }\n .data-subtab:hover {\n color: var(--sim-text);\n background: var(--sim-border);\n }\n .data-subtab.active {\n color: var(--sim-panel);\n background: var(--sim-accent);\n border-color: var(--sim-accent);\n }\n .data-subtab-content {\n display: none;\n flex: 1;\n overflow-y: auto;\n overflow-x: hidden;\n }\n .data-subtab-content.active {\n display: flex;\n flex-direction: column;\n }\n /* History tab styles */\n .history-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 6px;\n flex-shrink: 0;\n }\n .history-list {\n display: flex;\n flex-direction: column;\n gap: 4px;\n flex: 1;\n overflow-y: auto;\n }\n .history-item {\n padding: 6px;\n background: var(--sim-bg);\n border: 1px solid var(--sim-border);\n border-radius: 2px;\n display: flex;\n flex-direction: row;\n gap: 8px;\n }\n .history-item:hover {\n border-color: var(--sim-border-light);\n }\n .history-item-thumb {\n width: 80px;\n height: 80px;\n flex-shrink: 0;\n background: var(--history-thumb-bg, var(--sim-bg-alt));\n border: 1px solid var(--sim-border);\n border-radius: 2px;\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n }\n .history-item-thumb svg {\n width: 100%;\n height: 100%;\n }\n .history-item-thumb:empty {\n display: none;\n }\n .history-item-content {\n flex: 1;\n min-width: 0;\n display: flex;\n flex-direction: column;\n gap: 4px;\n }\n .history-item-header {\n display: flex;\n align-items: center;\n gap: 6px;\n }\n .history-item-num {\n color: var(--sim-accent);\n font-weight: bold;\n font-size: 9px;\n }\n .history-item-time {\n color: var(--sim-text-dim);\n font-size: 9px;\n flex: 1;\n }\n .history-item-preview {\n font-size: 9px;\n color: var(--sim-text);\n word-break: break-all;\n line-height: 1.3;\n background: var(--sim-bg-alt);\n padding: 3px 4px;\n border-radius: 2px;\n flex: 1;\n overflow: hidden;\n }\n /* Saves tab styles */\n .save-new {\n display: flex;\n gap: 4px;\n margin-bottom: 8px;\n flex-shrink: 0;\n }\n .save-new .simulator-input {\n flex: 1;\n }\n .saves-list {\n display: flex;\n flex-direction: column;\n gap: 4px;\n flex: 1;\n overflow-y: auto;\n }\n .save-item {\n padding: 6px;\n background: var(--sim-bg);\n border: 1px solid var(--sim-border);\n border-radius: 2px;\n }\n .save-item:hover {\n border-color: var(--sim-border-light);\n }\n .save-item-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 4px;\n }\n .save-item-name {\n color: var(--sim-text);\n font-weight: bold;\n font-size: 10px;\n }\n .save-item-time {\n color: var(--sim-text-dim);\n font-size: 9px;\n }\n .save-item-actions {\n display: flex;\n gap: 4px;\n }\n /* Features view styles */\n .features-view-container {\n display: flex;\n flex-direction: column;\n height: 100%;\n overflow: hidden;\n }\n .features-slug-input {\n display: flex;\n gap: 4px;\n margin-bottom: 8px;\n }\n .features-slug-input .simulator-input {\n flex: 1;\n }\n .features-content {\n flex: 1;\n overflow-y: auto;\n }\n .features-loading {\n color: var(--sim-text-dim);\n font-size: 10px;\n text-align: center;\n padding: 20px;\n }\n .features-error {\n color: var(--sim-error);\n font-size: 10px;\n padding: 8px;\n background: rgba(248, 113, 113, 0.1);\n border: 1px solid var(--sim-error);\n border-radius: 2px;\n }\n .features-empty {\n color: var(--sim-text-dim);\n font-size: 10px;\n text-align: center;\n padding: 20px;\n }\n .features-auth-required {\n color: var(--sim-text-dim);\n font-size: 10px;\n padding: 12px;\n background: var(--sim-bg);\n border: 1px solid var(--sim-border);\n border-radius: 2px;\n line-height: 1.5;\n }\n .features-auth-required p {\n margin: 0 0 8px 0;\n }\n .features-auth-required p:last-child {\n margin-bottom: 0;\n }\n .features-game-name {\n color: var(--sim-accent);\n font-size: 11px;\n font-weight: bold;\n margin-bottom: 8px;\n padding-bottom: 4px;\n border-bottom: 1px solid var(--sim-border);\n }\n .feature-group {\n margin-bottom: 12px;\n }\n .feature-group-title {\n color: var(--sim-text);\n font-size: 10px;\n font-weight: bold;\n text-transform: uppercase;\n letter-spacing: 0.5px;\n margin-bottom: 6px;\n padding-bottom: 2px;\n border-bottom: 1px solid var(--sim-border);\n }\n .feature-group-items {\n display: flex;\n flex-direction: column;\n gap: 2px;\n }\n .feature-item {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 4px 6px;\n background: var(--sim-bg);\n border: 1px solid var(--sim-border);\n border-radius: 2px;\n cursor: pointer;\n transition: all 0.15s ease;\n }\n .feature-item:hover {\n border-color: var(--sim-border-light);\n background: var(--sim-bg-alt);\n }\n .feature-item.updating {\n opacity: 0.5;\n pointer-events: none;\n }\n .feature-status {\n font-size: 14px;\n width: 18px;\n text-align: center;\n flex-shrink: 0;\n }\n .feature-item.enabled .feature-status {\n color: var(--sim-success);\n }\n .feature-item.disabled .feature-status {\n color: var(--sim-error);\n opacity: 0.5;\n }\n .feature-title {\n font-size: 10px;\n color: var(--sim-text);\n flex: 1;\n }\n .feature-item.disabled .feature-title {\n color: var(--sim-text-dim);\n }\n /* Checkpoints view styles */\n .checkpoints-view-container {\n display: flex;\n flex-direction: column;\n height: 100%;\n overflow: hidden;\n }\n .checkpoints-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 6px;\n flex-shrink: 0;\n }\n .checkpoints-list {\n display: flex;\n flex-direction: column;\n gap: 4px;\n flex: 1;\n overflow-y: auto;\n }\n .checkpoint-item {\n padding: 6px;\n background: var(--sim-bg);\n border: 1px solid var(--sim-border);\n border-left: 3px solid var(--sim-accent);\n border-radius: 2px;\n }\n .checkpoint-item:hover {\n border-color: var(--sim-border-light);\n border-left-color: var(--sim-accent);\n }\n .checkpoint-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n .checkpoint-item .simulator-deeds {\n margin-top: 4px;\n }\n .checkpoint-name {\n color: var(--sim-accent);\n font-weight: bold;\n font-size: 10px;\n }\n .checkpoint-time {\n color: var(--sim-text-dim);\n font-size: 9px;\n }\n /* Keyboard view styles */\n .keyboard-view-container {\n padding: 4px;\n }\n .sim-kb-empty {\n color: var(--sim-text-dim);\n text-align: center;\n padding: 16px 8px;\n font-size: 10px;\n line-height: 1.6;\n }\n .sim-kb-empty code {\n background: var(--sim-bg);\n padding: 1px 4px;\n border-radius: 2px;\n font-size: 10px;\n }\n .sim-kb {\n display: flex;\n flex-direction: column;\n gap: 4px;\n }\n .sim-kb-row {\n display: flex;\n justify-content: center;\n gap: 3px;\n }\n .sim-kb-key {\n min-width: 28px;\n height: 30px;\n padding: 0 4px;\n border: 1px solid var(--sim-border);\n border-radius: 3px;\n background: var(--sim-bg);\n color: var(--sim-text);\n font: inherit;\n font-size: 11px;\n text-transform: uppercase;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n .sim-kb-key:hover {\n background: var(--sim-bg-alt);\n border-color: var(--sim-border-light);\n }\n .sim-kb-key:active {\n background: var(--sim-accent);\n color: var(--sim-panel);\n }\n .sim-kb-key.highlight {\n background: var(--sim-bg-alt);\n border-color: var(--sim-accent);\n color: var(--sim-accent);\n font-size: 9px;\n }\n .sim-kb-key.highlight:active {\n background: var(--sim-accent);\n color: var(--sim-panel);\n }\n .sim-kb-key.l {\n min-width: 40px;\n }\n .sim-kb-key.xl {\n min-width: 52px;\n }\n .sim-kb-key.grow {\n flex: 1;\n }\n .sim-kb-key.disabled {\n opacity: 0.3;\n cursor: default;\n }\n /* Settings view styles */\n .settings-view-container {\n display: flex;\n flex-direction: column;\n height: 100%;\n overflow-y: auto;\n }\n .sim-settings-empty {\n color: var(--sim-text-dim);\n font-size: 10px;\n text-align: center;\n padding: 20px;\n line-height: 1.5;\n }\n .sim-settings-heading {\n color: var(--sim-text);\n font-size: 11px;\n font-weight: bold;\n text-transform: uppercase;\n letter-spacing: 1px;\n margin: 6px 0 4px;\n }\n .sim-settings-subheading {\n color: var(--sim-text);\n font-size: 10px;\n font-weight: bold;\n margin: 4px 0 2px;\n }\n .sim-settings-paragraph {\n color: var(--sim-text-dim);\n font-size: 10px;\n margin: 2px 0 6px;\n line-height: 1.4;\n }\n .sim-settings-subtitle {\n color: var(--sim-text-dim);\n font-size: 9px;\n margin: -2px 0 3px;\n line-height: 1.3;\n }\n .sim-settings-row {\n display: flex;\n align-items: baseline;\n gap: 6px;\n cursor: pointer;\n }\n .sim-settings-row .simulator-label {\n margin-bottom: 0;\n }\n .sim-settings-split {\n display: flex;\n gap: 8px;\n }\n .sim-settings-split > * {\n flex: 1;\n }\n .sim-settings-unsupported {\n color: var(--sim-text-dim);\n font-size: 9px;\n font-style: italic;\n margin: 4px 0;\n }\n .sim-settings-actions {\n margin-top: 8px;\n padding-top: 8px;\n border-top: 2px solid var(--sim-border);\n }\n";
1
+ export declare const simulatorStyles = "\n :root {\n --sim-bg: #1a1a2e;\n --sim-bg-alt: #16213e;\n --sim-panel: #0f0f1a;\n --sim-border: #3a3a5c;\n --sim-border-light: #5a5a8c;\n --sim-accent: #ffd700;\n --sim-accent-hover: #ffed4a;\n --sim-text: #e8e8e8;\n --sim-text-dim: #888899;\n --sim-success: #4ade80;\n --sim-error: #f87171;\n --sim-warning: #fbbf24;\n --sim-blue: #60a5fa;\n }\n #simulator {\n position: fixed;\n bottom: 4px;\n left: 4px;\n z-index: 999999;\n font: 11px/1.4 \"Menlo\", \"Monaco\", \"Consolas\", monospace;\n user-select: none;\n }\n #simulator-panel {\n background: var(--sim-panel);\n border: 2px solid var(--sim-border);\n border-radius: 4px;\n color: var(--sim-text);\n width: 420px;\n max-width: calc(100vw - 8px);\n box-shadow: 4px 4px 0 rgba(0,0,0,0.5);\n }\n #simulator-panel.collapsed {\n width: auto;\n }\n #simulator-header {\n display: flex;\n align-items: center;\n padding: 4px 8px;\n background: var(--sim-bg);\n border-bottom: 2px solid var(--sim-border);\n gap: 0;\n }\n #simulator-panel.collapsed #simulator-header {\n border-bottom: none;\n cursor: pointer;\n }\n #simulator-panel.collapsed #simulator-header:hover {\n background: var(--sim-bg-alt);\n }\n .header-sep {\n color: var(--sim-border-light);\n margin: 0 8px;\n opacity: 0.6;\n }\n .header-spacer {\n flex: 1;\n }\n #simulator-title {\n color: var(--sim-accent);\n text-transform: uppercase;\n letter-spacing: 1px;\n font-size: 10px;\n font-weight: bold;\n }\n #simulator-header-controls {\n display: flex;\n gap: 2px;\n }\n .header-icon-btn {\n width: 20px;\n height: 20px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: transparent;\n border: none;\n border-radius: 2px;\n color: var(--sim-text);\n cursor: pointer;\n padding: 0;\n }\n .header-icon-btn:hover:not(:disabled) {\n background: var(--sim-border);\n color: var(--sim-accent);\n }\n .header-icon-btn:disabled {\n opacity: 0.3;\n cursor: not-allowed;\n }\n .header-icon-btn.active {\n background: var(--sim-accent);\n color: var(--sim-panel);\n }\n #simulator-header-status {\n display: flex;\n align-items: center;\n gap: 4px;\n font-size: 9px;\n color: var(--sim-text-dim);\n }\n #simulator-header-indicator {\n width: 6px;\n height: 6px;\n border-radius: 50%;\n background: var(--sim-text-dim);\n flex-shrink: 0;\n }\n #simulator-header-indicator.ready {\n background: var(--sim-success);\n box-shadow: 0 0 4px var(--sim-success);\n }\n #simulator-header-indicator.waiting {\n background: var(--sim-warning);\n box-shadow: 0 0 4px var(--sim-warning);\n }\n #simulator-header-indicator.paused {\n background: var(--sim-error);\n box-shadow: 0 0 4px var(--sim-error);\n }\n #simulator-header-indicator.complete {\n background: transparent;\n box-shadow: none;\n color: var(--sim-success);\n width: auto;\n height: auto;\n font-size: 11px;\n line-height: 1;\n font-weight: bold;\n }\n #simulator-timer {\n font-size: 11px;\n color: var(--sim-text);\n font-family: \"Menlo\", monospace;\n font-weight: bold;\n font-variant-numeric: tabular-nums;\n min-width: 38px;\n }\n #simulator-timer .penalty {\n color: var(--sim-error);\n margin-left: 2px;\n }\n /* Collapsed state - show minimal bar */\n #simulator-panel.collapsed .header-sep,\n #simulator-panel.collapsed #simulator-header-controls,\n #simulator-panel.collapsed #simulator-header-status,\n #simulator-panel.collapsed #simulator-header-settings,\n #simulator-panel.collapsed #simulator-toggle {\n display: none;\n }\n #simulator-panel.collapsed #simulator-title {\n cursor: pointer;\n }\n #simulator-panel.collapsed #simulator-timer {\n margin-left: 8px;\n }\n #simulator-body {\n display: flex;\n flex-direction: row;\n }\n #simulator-panel.collapsed #simulator-body {\n display: none;\n }\n #simulator-tabs {\n display: flex;\n flex-direction: column;\n background: var(--sim-bg);\n padding: 4px;\n gap: 2px;\n border-right: 2px solid var(--sim-border);\n }\n .simulator-tab {\n padding: 2px 3px;\n background: var(--sim-bg-alt);\n border: 2px solid var(--sim-border);\n border-radius: 2px;\n color: var(--sim-text-dim);\n cursor: pointer;\n font: inherit;\n text-transform: uppercase;\n font-size: 9px;\n font-weight: bold;\n letter-spacing: 0.5px;\n min-height: 0;\n }\n .simulator-tab:hover {\n color: var(--sim-text);\n background: var(--sim-border);\n }\n .simulator-tab.active {\n color: var(--sim-panel);\n background: var(--sim-accent);\n border-color: var(--sim-accent);\n }\n .simulator-tab {\n position: relative;\n }\n .simulator-tab-badge {\n position: absolute;\n top: -4px;\n right: -4px;\n min-width: 14px;\n height: 14px;\n padding: 0 3px;\n background: var(--sim-blue);\n color: #fff;\n font-size: 8px;\n font-weight: bold;\n border-radius: 7px;\n display: flex;\n align-items: center;\n justify-content: center;\n box-shadow: 0 1px 2px rgba(0,0,0,0.3);\n line-height: 1;\n text-align: center;\n box-sizing: border-box;\n }\n .simulator-tab-badge:empty {\n display: none;\n }\n #simulator-content {\n padding: 6px;\n background: var(--sim-panel);\n height: 500px;\n flex: 1;\n overflow-y: auto;\n }\n #simulator-content.hidden {\n display: none;\n }\n #simulator-content::-webkit-scrollbar {\n width: 8px;\n }\n #simulator-content::-webkit-scrollbar-track {\n background: var(--sim-bg);\n }\n #simulator-content::-webkit-scrollbar-thumb {\n background: var(--sim-border);\n border-radius: 2px;\n }\n .simulator-btn {\n padding: 4px 8px;\n background: var(--sim-bg-alt);\n border: 2px solid var(--sim-border);\n border-radius: 2px;\n color: var(--sim-text);\n font: inherit;\n font-size: 10px;\n font-weight: bold;\n text-transform: uppercase;\n letter-spacing: 1px;\n cursor: pointer;\n }\n .simulator-btn:hover {\n background: var(--sim-border);\n border-color: var(--sim-border-light);\n }\n .simulator-btn:active {\n transform: translate(1px, 1px);\n }\n .simulator-btn.primary {\n background: var(--sim-accent);\n border-color: var(--sim-accent);\n color: var(--sim-panel);\n }\n .simulator-btn.primary:hover {\n background: var(--sim-accent-hover);\n border-color: var(--sim-accent-hover);\n }\n .simulator-btn.danger {\n background: var(--sim-error);\n border-color: var(--sim-error);\n color: #fff;\n }\n .simulator-btn.danger:hover {\n background: #ef4444;\n border-color: #ef4444;\n }\n .simulator-btn:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n transform: none;\n }\n .simulator-btn.subtle {\n background: transparent;\n border-color: transparent;\n color: var(--sim-text-dim);\n }\n .simulator-btn.subtle:hover:not(:disabled) {\n background: var(--sim-bg-alt);\n border-color: var(--sim-border);\n color: var(--sim-text);\n }\n #simulator-status {\n font-size: 10px;\n color: var(--sim-text-dim);\n padding: 4px 0 6px;\n display: flex;\n align-items: center;\n gap: 6px;\n }\n #simulator-status .indicator {\n width: 8px;\n height: 8px;\n border-radius: 2px;\n background: var(--sim-text-dim);\n }\n #simulator-status .indicator.ready {\n background: var(--sim-success);\n box-shadow: 0 0 6px var(--sim-success);\n }\n #simulator-status .indicator.waiting {\n background: var(--sim-warning);\n box-shadow: 0 0 6px var(--sim-warning);\n }\n #simulator-status .indicator.paused {\n background: var(--sim-error);\n box-shadow: 0 0 6px var(--sim-error);\n }\n #simulator-status .indicator.complete {\n background: transparent;\n box-shadow: none;\n color: var(--sim-success);\n width: auto;\n height: auto;\n font-size: 12px;\n line-height: 1;\n font-weight: bold;\n }\n .simulator-row {\n display: flex;\n gap: 4px;\n margin-top: 4px;\n }\n .simulator-row .simulator-btn {\n flex: 1;\n }\n .simulator-divider {\n height: 2px;\n background: var(--sim-border);\n margin: 8px 0;\n }\n .simulator-field {\n margin-bottom: 6px;\n }\n .simulator-select {\n width: 100%;\n padding: 4px 6px;\n background: var(--sim-bg);\n border: 2px solid var(--sim-border);\n border-radius: 2px;\n color: var(--sim-text);\n font: inherit;\n font-size: 10px;\n cursor: pointer;\n }\n .simulator-select:focus {\n outline: none;\n border-color: var(--sim-accent);\n }\n .simulator-select option {\n background: var(--sim-bg);\n color: var(--sim-text);\n }\n .simulator-fixtures {\n margin-bottom: 8px;\n padding-bottom: 8px;\n border-bottom: 2px solid var(--sim-border);\n }\n .simulator-label {\n display: block;\n color: var(--sim-accent);\n text-transform: uppercase;\n font-size: 9px;\n font-weight: bold;\n letter-spacing: 1px;\n margin-bottom: 4px;\n }\n .simulator-textarea {\n width: 100%;\n min-height: 40px;\n background: var(--sim-bg);\n border: 2px solid var(--sim-border);\n border-radius: 2px;\n color: var(--sim-text);\n font: 10px/1.4 \"Menlo\", monospace;\n padding: 4px;\n resize: none;\n box-sizing: border-box;\n overflow-y: auto;\n }\n .simulator-textarea.auto-resize {\n resize: none;\n overflow-y: auto;\n }\n .simulator-textarea:focus {\n outline: none;\n border-color: var(--sim-accent);\n }\n .simulator-input {\n width: 100%;\n background: var(--sim-bg);\n border: 2px solid var(--sim-border);\n border-radius: 2px;\n color: var(--sim-text);\n font: 10px/1.4 \"Menlo\", monospace;\n padding: 4px 6px;\n box-sizing: border-box;\n }\n .simulator-input:focus {\n outline: none;\n border-color: var(--sim-accent);\n }\n .simulator-input::placeholder {\n color: var(--sim-text-dim);\n }\n .simulator-tab-content {\n display: none;\n }\n .simulator-tab-content.active {\n display: block;\n }\n .msgs-view-container {\n display: flex;\n flex-direction: column;\n height: 100%;\n overflow: hidden;\n }\n .msgs-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 6px;\n flex-shrink: 0;\n }\n #simulator-msgs-log {\n display: flex;\n flex-direction: column;\n gap: 2px;\n flex: 1;\n overflow-y: auto;\n }\n .simulator-msg {\n padding: 3px 4px;\n background: var(--sim-bg);\n border: 1px solid var(--sim-border);\n border-radius: 2px;\n font-size: 10px;\n }\n .simulator-msg.out {\n border-left: 2px solid var(--sim-accent);\n }\n .simulator-msg.in {\n border-left: 2px solid var(--sim-blue);\n }\n .simulator-msg-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 2px;\n }\n .simulator-msg-type {\n font-weight: bold;\n color: var(--sim-text);\n }\n .simulator-msg.out .simulator-msg-type {\n color: var(--sim-accent);\n }\n .simulator-msg.in .simulator-msg-type {\n color: var(--sim-blue);\n }\n .simulator-msg-time {\n color: var(--sim-text-dim);\n font-size: 9px;\n }\n .simulator-msg-data {\n color: var(--sim-text-dim);\n font-size: 9px;\n white-space: pre-wrap;\n word-break: break-all;\n max-height: 60px;\n overflow: hidden;\n cursor: pointer;\n border-radius: 2px;\n padding: 2px 4px;\n background: var(--sim-bg-alt);\n }\n .simulator-msg-data:hover {\n background: var(--sim-border);\n }\n .simulator-msg.expanded {\n flex: 1;\n display: flex;\n flex-direction: column;\n }\n .simulator-msg.expanded .simulator-msg-data {\n max-height: none;\n flex: 1;\n overflow-y: auto;\n }\n .simulator-empty {\n color: var(--sim-text-dim);\n font-size: 10px;\n text-align: center;\n padding: 20px;\n }\n .simulator-share-preview {\n margin: 0;\n padding: 8px;\n text-align: left;\n font-size: 13px;\n line-height: 1.45;\n white-space: pre-wrap;\n font-family: ui-monospace, SFMono-Regular, Menlo, monospace;\n }\n .simulator-segmented {\n display: flex;\n gap: 2px;\n padding: 2px;\n background: var(--sim-bg);\n border: 2px solid var(--sim-border);\n border-radius: 2px;\n margin-bottom: 6px;\n }\n .simulator-segmented-btn {\n flex: 1;\n padding: 4px 8px;\n background: transparent;\n border: 0;\n border-radius: 2px;\n color: var(--sim-text-dim);\n font: inherit;\n font-size: 10px;\n font-weight: bold;\n text-transform: uppercase;\n letter-spacing: 1px;\n cursor: pointer;\n }\n .simulator-segmented-btn:hover:not(.active) {\n color: var(--sim-text);\n }\n .simulator-segmented-btn.active {\n background: var(--sim-border);\n color: var(--sim-text);\n }\n .simulator-share-missing {\n color: var(--sim-text-dim);\n font-size: 11px;\n padding: 12px;\n line-height: 1.4;\n }\n .simulator-share-missing p {\n margin: 0 0 6px;\n }\n .simulator-share-missing code {\n color: var(--sim-text);\n background: var(--sim-bg);\n padding: 1px 4px;\n border-radius: 2px;\n font-family: ui-monospace, SFMono-Regular, Menlo, monospace;\n }\n .simulator-share-missing pre {\n margin: 6px 0 0;\n padding: 8px;\n background: var(--sim-bg);\n border: 1px solid var(--sim-border);\n border-radius: 2px;\n color: var(--sim-text);\n font-family: ui-monospace, SFMono-Regular, Menlo, monospace;\n font-size: 10.5px;\n line-height: 1.45;\n white-space: pre-wrap;\n overflow-x: auto;\n }\n .simulator-value {\n color: var(--sim-text);\n font-size: 10px;\n padding: 4px;\n background: var(--sim-bg);\n border: 1px solid var(--sim-border);\n border-radius: 2px;\n }\n .simulator-deeds {\n display: flex;\n flex-direction: column;\n gap: 2px;\n }\n .simulator-deed {\n display: flex;\n justify-content: space-between;\n padding: 3px 4px;\n background: var(--sim-bg);\n border: 1px solid var(--sim-border);\n border-radius: 2px;\n font-size: 10px;\n }\n .simulator-deed-name {\n color: var(--sim-text);\n }\n .simulator-deed-value {\n color: var(--sim-accent);\n font-weight: bold;\n }\n .thumb-view-container {\n display: flex;\n flex-direction: column;\n height: 100%;\n overflow: hidden;\n }\n .thumb-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 6px;\n flex-shrink: 0;\n }\n #simulator-thumb-preview {\n background: var(--sim-thumb-bg, transparent);\n border: 2px solid var(--sim-border);\n border-radius: 2px;\n padding: 8px;\n display: flex;\n align-items: center;\n justify-content: center;\n aspect-ratio: 1;\n width: 100%;\n box-sizing: border-box;\n }\n #simulator-thumb-preview svg {\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n }\n #simulator-thumb-fn {\n font-size: 10px;\n color: var(--sim-text-dim);\n margin-top: 4px;\n }\n .theme-view-container {\n display: flex;\n flex-direction: column;\n height: 100%;\n overflow: hidden;\n }\n .theme-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 6px;\n flex-shrink: 0;\n }\n .simulator-themes {\n display: flex;\n flex-direction: column;\n gap: 4px;\n flex: 1;\n overflow-y: auto;\n }\n .simulator-theme-item {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 4px;\n background: var(--sim-bg);\n border: 2px solid var(--sim-border);\n border-radius: 2px;\n cursor: pointer;\n }\n .simulator-theme-item:hover {\n border-color: var(--sim-border-light);\n }\n .simulator-theme-item.selected {\n border-color: var(--sim-accent);\n background: var(--sim-bg-alt);\n }\n .simulator-theme-preview {\n width: 48px;\n height: 32px;\n display: grid;\n grid-template-columns: repeat(3, 1fr);\n grid-template-rows: repeat(2, 1fr);\n gap: 1px;\n border-radius: 2px;\n overflow: hidden;\n flex-shrink: 0;\n }\n .simulator-theme-preview-cell {\n width: 100%;\n height: 100%;\n }\n .simulator-theme-name {\n font-size: 10px;\n color: var(--sim-text);\n flex: 1;\n }\n .simulator-theme-type {\n font-size: 9px;\n color: var(--sim-text-dim);\n text-transform: uppercase;\n }\n /* Auth tab styles */\n .simulator-section {\n margin-bottom: 12px;\n }\n .simulator-section-title {\n color: var(--sim-accent);\n text-transform: uppercase;\n font-size: 10px;\n font-weight: bold;\n letter-spacing: 1px;\n margin-bottom: 6px;\n padding-bottom: 4px;\n border-bottom: 1px solid var(--sim-border);\n }\n .auth-header-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 6px;\n }\n .auth-status {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 10px;\n color: var(--sim-text-dim);\n padding: 4px 0;\n }\n .auth-status.authenticated {\n color: var(--sim-success);\n }\n .simulator-btn.small {\n padding: 2px 6px;\n font-size: 9px;\n }\n .simulator-btn.tiny {\n padding: 3px 2px;\n font-size: 8px;\n border-width: 1px;\n line-height: 1;\n min-height: 0;\n height: auto;\n }\n .auth-title-row {\n display: flex;\n align-items: center;\n gap: 6px;\n }\n .auth-title-row > span:first-child {\n flex: 1;\n }\n .auth-title-row .simulator-btn.active {\n background: var(--sim-accent);\n color: black;\n }\n .auth-description {\n font-size: 10px;\n color: var(--sim-text-dim);\n margin: 6px 0;\n line-height: 1.4;\n }\n .auth-user-info {\n font-size: 10px;\n color: var(--sim-text-dim);\n padding: 6px;\n background: var(--sim-bg);\n border: 1px solid var(--sim-border);\n border-radius: 2px;\n margin-bottom: 8px;\n }\n .auth-user-info div {\n margin-bottom: 4px;\n }\n .auth-user-info div:last-child {\n margin-bottom: 0;\n }\n .auth-user-info code {\n color: var(--sim-text);\n background: var(--sim-bg-alt);\n padding: 1px 4px;\n border-radius: 2px;\n }\n .auth-warning {\n color: var(--sim-warning);\n font-style: italic;\n }\n .auth-error {\n margin-top: 8px;\n }\n .auth-error .error,\n .auth-api-result .error {\n color: var(--sim-error);\n font-size: 10px;\n padding: 6px;\n background: rgba(248, 113, 113, 0.1);\n border: 1px solid var(--sim-error);\n border-radius: 2px;\n }\n .auth-api-result {\n margin-top: 8px;\n }\n .auth-api-result pre {\n font-size: 9px;\n color: var(--sim-text);\n background: var(--sim-bg);\n border: 1px solid var(--sim-border);\n border-radius: 2px;\n padding: 6px;\n margin: 0;\n white-space: pre-wrap;\n word-break: break-all;\n max-height: 150px;\n overflow-y: auto;\n }\n .auth-api-result .loading {\n font-size: 10px;\n color: var(--sim-text-dim);\n padding: 6px;\n background: var(--sim-bg);\n border: 1px solid var(--sim-border);\n border-radius: 2px;\n }\n /* Data view styles */\n .data-view-container {\n display: flex;\n flex-direction: column;\n height: 100%;\n overflow: hidden;\n }\n .data-subtabs {\n display: flex;\n gap: 2px;\n margin-bottom: 8px;\n flex-shrink: 0;\n }\n .data-subtab {\n padding: 4px 10px;\n background: var(--sim-bg-alt);\n border: 1px solid var(--sim-border);\n border-radius: 2px;\n color: var(--sim-text-dim);\n cursor: pointer;\n font: inherit;\n font-size: 9px;\n font-weight: bold;\n text-transform: uppercase;\n letter-spacing: 0.5px;\n }\n .data-subtab:hover {\n color: var(--sim-text);\n background: var(--sim-border);\n }\n .data-subtab.active {\n color: var(--sim-panel);\n background: var(--sim-accent);\n border-color: var(--sim-accent);\n }\n .data-subtab-content {\n display: none;\n flex: 1;\n overflow-y: auto;\n overflow-x: hidden;\n }\n .data-subtab-content.active {\n display: flex;\n flex-direction: column;\n }\n /* History tab styles */\n .history-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 6px;\n flex-shrink: 0;\n }\n .history-list {\n display: flex;\n flex-direction: column;\n gap: 4px;\n flex: 1;\n overflow-y: auto;\n }\n .history-item {\n padding: 6px;\n background: var(--sim-bg);\n border: 1px solid var(--sim-border);\n border-radius: 2px;\n display: flex;\n flex-direction: row;\n gap: 8px;\n }\n .history-item:hover {\n border-color: var(--sim-border-light);\n }\n .history-item-thumb {\n width: 80px;\n height: 80px;\n flex-shrink: 0;\n background: var(--history-thumb-bg, var(--sim-bg-alt));\n border: 1px solid var(--sim-border);\n border-radius: 2px;\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n }\n .history-item-thumb svg {\n width: 100%;\n height: 100%;\n }\n .history-item-thumb:empty {\n display: none;\n }\n .history-item-content {\n flex: 1;\n min-width: 0;\n display: flex;\n flex-direction: column;\n gap: 4px;\n }\n .history-item-header {\n display: flex;\n align-items: center;\n gap: 6px;\n }\n .history-item-num {\n color: var(--sim-accent);\n font-weight: bold;\n font-size: 9px;\n }\n .history-item-time {\n color: var(--sim-text-dim);\n font-size: 9px;\n flex: 1;\n }\n .history-item-preview {\n font-size: 9px;\n color: var(--sim-text);\n word-break: break-all;\n line-height: 1.3;\n background: var(--sim-bg-alt);\n padding: 3px 4px;\n border-radius: 2px;\n flex: 1;\n overflow: hidden;\n }\n /* Saves tab styles */\n .save-new {\n display: flex;\n gap: 4px;\n margin-bottom: 8px;\n flex-shrink: 0;\n }\n .save-new .simulator-input {\n flex: 1;\n }\n .saves-list {\n display: flex;\n flex-direction: column;\n gap: 4px;\n flex: 1;\n overflow-y: auto;\n }\n .save-item {\n padding: 6px;\n background: var(--sim-bg);\n border: 1px solid var(--sim-border);\n border-radius: 2px;\n }\n .save-item:hover {\n border-color: var(--sim-border-light);\n }\n .save-item-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 4px;\n }\n .save-item-name {\n color: var(--sim-text);\n font-weight: bold;\n font-size: 10px;\n }\n .save-item-time {\n color: var(--sim-text-dim);\n font-size: 9px;\n }\n .save-item-actions {\n display: flex;\n gap: 4px;\n }\n /* Features view styles */\n .features-view-container {\n display: flex;\n flex-direction: column;\n height: 100%;\n overflow: hidden;\n }\n .features-slug-input {\n display: flex;\n gap: 4px;\n margin-bottom: 8px;\n }\n .features-slug-input .simulator-input {\n flex: 1;\n }\n .features-content {\n flex: 1;\n overflow-y: auto;\n }\n .features-loading {\n color: var(--sim-text-dim);\n font-size: 10px;\n text-align: center;\n padding: 20px;\n }\n .features-error {\n color: var(--sim-error);\n font-size: 10px;\n padding: 8px;\n background: rgba(248, 113, 113, 0.1);\n border: 1px solid var(--sim-error);\n border-radius: 2px;\n }\n .features-empty {\n color: var(--sim-text-dim);\n font-size: 10px;\n text-align: center;\n padding: 20px;\n }\n .features-auth-required {\n color: var(--sim-text-dim);\n font-size: 10px;\n padding: 12px;\n background: var(--sim-bg);\n border: 1px solid var(--sim-border);\n border-radius: 2px;\n line-height: 1.5;\n }\n .features-auth-required p {\n margin: 0 0 8px 0;\n }\n .features-auth-required p:last-child {\n margin-bottom: 0;\n }\n .features-game-name {\n color: var(--sim-accent);\n font-size: 11px;\n font-weight: bold;\n margin-bottom: 8px;\n padding-bottom: 4px;\n border-bottom: 1px solid var(--sim-border);\n }\n .feature-group {\n margin-bottom: 12px;\n }\n .feature-group-title {\n color: var(--sim-text);\n font-size: 10px;\n font-weight: bold;\n text-transform: uppercase;\n letter-spacing: 0.5px;\n margin-bottom: 6px;\n padding-bottom: 2px;\n border-bottom: 1px solid var(--sim-border);\n }\n .feature-group-items {\n display: flex;\n flex-direction: column;\n gap: 2px;\n }\n .feature-item {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 4px 6px;\n background: var(--sim-bg);\n border: 1px solid var(--sim-border);\n border-radius: 2px;\n cursor: pointer;\n transition: all 0.15s ease;\n }\n .feature-item:hover {\n border-color: var(--sim-border-light);\n background: var(--sim-bg-alt);\n }\n .feature-item.updating {\n opacity: 0.5;\n pointer-events: none;\n }\n .feature-status {\n font-size: 14px;\n width: 18px;\n text-align: center;\n flex-shrink: 0;\n }\n .feature-item.enabled .feature-status {\n color: var(--sim-success);\n }\n .feature-item.disabled .feature-status {\n color: var(--sim-error);\n opacity: 0.5;\n }\n .feature-title {\n font-size: 10px;\n color: var(--sim-text);\n flex: 1;\n }\n .feature-item.disabled .feature-title {\n color: var(--sim-text-dim);\n }\n /* Checkpoints view styles */\n .checkpoints-view-container {\n display: flex;\n flex-direction: column;\n height: 100%;\n overflow: hidden;\n }\n .checkpoints-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 6px;\n flex-shrink: 0;\n }\n .checkpoints-list {\n display: flex;\n flex-direction: column;\n gap: 4px;\n flex: 1;\n overflow-y: auto;\n }\n .checkpoint-item {\n padding: 6px;\n background: var(--sim-bg);\n border: 1px solid var(--sim-border);\n border-left: 3px solid var(--sim-accent);\n border-radius: 2px;\n }\n .checkpoint-item:hover {\n border-color: var(--sim-border-light);\n border-left-color: var(--sim-accent);\n }\n .checkpoint-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n .checkpoint-item .simulator-deeds {\n margin-top: 4px;\n }\n .checkpoint-name {\n color: var(--sim-accent);\n font-weight: bold;\n font-size: 10px;\n }\n .checkpoint-time {\n color: var(--sim-text-dim);\n font-size: 9px;\n }\n /* Keyboard view styles */\n .keyboard-view-container {\n padding: 4px;\n }\n .sim-kb-empty {\n color: var(--sim-text-dim);\n text-align: center;\n padding: 16px 8px;\n font-size: 10px;\n line-height: 1.6;\n }\n .sim-kb-empty code {\n background: var(--sim-bg);\n padding: 1px 4px;\n border-radius: 2px;\n font-size: 10px;\n }\n .sim-kb {\n display: flex;\n flex-direction: column;\n gap: 4px;\n }\n .sim-kb-row {\n display: flex;\n justify-content: center;\n gap: 3px;\n }\n .sim-kb-key {\n min-width: 28px;\n height: 30px;\n padding: 0 4px;\n border: 1px solid var(--sim-border);\n border-radius: 3px;\n background: var(--sim-bg);\n color: var(--sim-text);\n font: inherit;\n font-size: 11px;\n text-transform: uppercase;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n .sim-kb-key:hover {\n background: var(--sim-bg-alt);\n border-color: var(--sim-border-light);\n }\n .sim-kb-key:active {\n background: var(--sim-accent);\n color: var(--sim-panel);\n }\n .sim-kb-key.highlight {\n background: var(--sim-bg-alt);\n border-color: var(--sim-accent);\n color: var(--sim-accent);\n font-size: 9px;\n }\n .sim-kb-key.highlight:active {\n background: var(--sim-accent);\n color: var(--sim-panel);\n }\n .sim-kb-key.l {\n min-width: 40px;\n }\n .sim-kb-key.xl {\n min-width: 52px;\n }\n .sim-kb-key.grow {\n flex: 1;\n }\n .sim-kb-key.disabled {\n opacity: 0.3;\n cursor: default;\n }\n /* Settings view styles */\n .settings-view-container {\n display: flex;\n flex-direction: column;\n height: 100%;\n overflow-y: auto;\n }\n .sim-settings-empty {\n color: var(--sim-text-dim);\n font-size: 10px;\n text-align: center;\n padding: 20px;\n line-height: 1.5;\n }\n .sim-settings-heading {\n color: var(--sim-text);\n font-size: 11px;\n font-weight: bold;\n text-transform: uppercase;\n letter-spacing: 1px;\n margin: 6px 0 4px;\n }\n .sim-settings-subheading {\n color: var(--sim-text);\n font-size: 10px;\n font-weight: bold;\n margin: 4px 0 2px;\n }\n .sim-settings-paragraph {\n color: var(--sim-text-dim);\n font-size: 10px;\n margin: 2px 0 6px;\n line-height: 1.4;\n }\n .sim-settings-subtitle {\n color: var(--sim-text-dim);\n font-size: 9px;\n margin: -2px 0 3px;\n line-height: 1.3;\n }\n .sim-settings-row {\n display: flex;\n align-items: baseline;\n gap: 6px;\n cursor: pointer;\n }\n .sim-settings-row .simulator-label {\n margin-bottom: 0;\n }\n .sim-settings-split {\n display: flex;\n gap: 8px;\n }\n .sim-settings-split > * {\n flex: 1;\n }\n .sim-settings-unsupported {\n color: var(--sim-text-dim);\n font-size: 9px;\n font-style: italic;\n margin: 4px 0;\n }\n .sim-settings-actions {\n margin-top: 8px;\n padding-top: 8px;\n border-top: 2px solid var(--sim-border);\n }\n";
2
2
  //# sourceMappingURL=styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/simulator/styles.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,gq3BAmtC3B,CAAA"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/simulator/styles.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,s26BAuxC3B,CAAA"}
@@ -32,6 +32,11 @@ export interface SimulatorConfig {
32
32
  views?: SimulatorView[];
33
33
  }
34
34
  export type TabName = string;
35
+ /**
36
+ * Which bundle export the Thumb view previews. `image` calls `renderThumbnail`;
37
+ * `text` calls `getShareString`. Purely a simulator UI concept — the game never sees it.
38
+ */
39
+ export type PreviewKind = "image" | "text";
35
40
  /** A named `hostContext` scenario selectable in the Host tab. */
36
41
  export interface HostContextPreset {
37
42
  name: string;
@@ -52,6 +57,8 @@ export interface SimulatorState {
52
57
  selectedPuzzle: string | null;
53
58
  renderHost: ThumbnailConfig["renderHost"];
54
59
  renderContext: ThumbnailConfig["renderContext"];
60
+ /** Which bundle export the Thumb view previews (image ↔ text). */
61
+ previewKind: PreviewKind;
55
62
  /** The player's settings for this game, persisted to localStorage and sent in READY_DATA */
56
63
  gameSettings: Record<string, any>;
57
64
  /** The settings UI description from the game's INITIALIZE_SETTINGS, null until received */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/simulator/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,WAAW,EAAE,gBAAgB,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/G,mHAAmH;AACnH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAA;AAE1E,MAAM,WAAW,eAAe;IAC9B,iEAAiE;IACjE,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,yGAAyG;IACzG,QAAQ,CAAC,EAAE,cAAc,CAAA;IACzB,8DAA8D;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;;;OAKG;IACH,WAAW,CAAC,EAAE,WAAW,EAAE,CAAA;IAC3B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,CAAA;IACxC;;;;OAIG;IACH,KAAK,CAAC,EAAE,aAAa,EAAE,CAAA;CACxB;AAED,MAAM,MAAM,OAAO,GAAG,MAAM,CAAA;AAE5B,iEAAiE;AACjE,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAA;IAC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IAAI,CAAA;CAC/C;AAED,wBAAgB,eAAe,IAAI,iBAAiB,CAkInD"}
1
+ {"version":3,"file":"ThumbView.d.ts","sourceRoot":"","sources":["../../../src/simulator/views/ThumbView.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAe,gBAAgB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AA4C5E,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACtD,aAAa,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,IAAI,CAAA;CAC/C;AAED,wBAAgB,eAAe,IAAI,iBAAiB,CA2LnD"}
package/dist/types.d.ts CHANGED
@@ -92,8 +92,12 @@ export type AugmentationConfig = {
92
92
  deeds?: Deed[] | Readonly<Deed[]>;
93
93
  };
94
94
  export type CheckpointConfig = {
95
+ /** Can the system show ads at this checkpoint */
95
96
  interruptible: boolean;
97
+ /** Has the game gone on enough to auto-complete */
96
98
  complete: boolean;
99
+ /** Which parts of the completion pipeline to process at this checkpoint (e.g. `["leaderboards"]`). Empty means nothing is processed. */
100
+ process: "leaderboards"[];
97
101
  };
98
102
  export type Deed = {
99
103
  id: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,KAAK,GAAG;IAClB,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,iCAAiC;IACjC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAA;IACtB,sBAAsB;IACtB,GAAG,EAAE,MAAM,CAAA;IACX,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAA;IACjB,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAA;IAChB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAA;IAEb,kFAAkF;IAClF,QAAQ,EAAE,MAAM,CAAA;IAChB,yCAAyC;IACzC,UAAU,EAAE,MAAM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AAU,EAAE;QAAE,IAAI,EAAE,GAAG,CAAA;KAAE,CAAA;IACzB,iGAAiG;IACjG,YAAY,EAAE,MAAM,CAAA;IACpB,mFAAiF;IACjF,UAAU,EAAE,SAAS,CAAA;IACrB,yHAAyH;IACzH,UAAU,EAAE,MAAM,CAAA;IAClB,mFAAmF;IACnF,WAAW,EAAE,MAAM,CAAA;IACnB,wGAAwG;IACxG,eAAe,EAAE,GAAG,CAAA;IACpB,oGAAoG;IACpG,kBAAkB,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;IACnC,sIAAsI;IACtI,sBAAsB,EAAE;QAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAAA;IACtD,oHAAoH;IACpH,mBAAmB,EAAE,MAAM,CAAA;CAC5B,CAAA"}
package/dist/vite.cjs CHANGED
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const c=require(`./objectSpread2-CuluYLUL.cjs`),l=require(`./asyncToGenerator-DANjdFmB.cjs`);let u=require(`vite`),d=require(`path`);d=s(d);let f=require(`fs`);f=s(f);function p(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function m(e,t){if(e==null)return{};var n,r,i=p(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var h=[`fixturesGlob`],g=`/@puzzmo-simulator-init.js`,_=`virtual:puzzmo-simulator`;function v(e){let t=new Map,n=D(e,3);f.default.existsSync(d.default.join(e,`puzzmo.json`))&&n.unshift(e);for(let i of n)try{var r;let n=JSON.parse(f.default.readFileSync(d.default.join(i,`puzzmo.json`),`utf-8`));if(!(!(n==null||(r=n.game)==null)&&r.slug))continue;let a=w(i,`src/appBundle`),o=null;a&&(o=`/`+d.default.relative(e,a).split(d.default.sep).join(`/`)),t.set(n.game.slug,{dir:i,slug:n.game.slug,displayName:n.game.displayName,appBundlePath:o})}catch(e){}return t}function y(e,t,n){if(e)try{let r=new URL(e).pathname;for(let e of t.values()){let t=`/`+d.default.relative(n,e.dir).split(d.default.sep).join(`/`);if(r.startsWith(t+`/`)||r===t)return e}}catch(e){}if(t.size===1)return t.values().next().value}function b(e,t){let{fixturesGlob:n}=e,r=m(e,h),i=n===!1?null:n==null?`/fixtures/puzzles/**/*.{json,toml}`:n,a=[`import { createSimulator } from "@puzzmo/sdk/simulator"`];i&&a.push(`const fixtures = import.meta.glob(${JSON.stringify(i)}, { query: "?raw", import: "default", eager: true })`),t!=null&&t.appBundlePath&&(a.push(`import(${JSON.stringify(t.appBundlePath)}).then(m => {`),a.push(` if (m.renderThumbnail) globalThis.renderThumbnail = m.renderThumbnail`),a.push(`}).catch(() => {})`));let o=c.t(c.t({},r),t!=null&&t.slug?{slug:t.slug}:{}),s=Object.entries(o).filter(([,e])=>e!==void 0).map(([e,t])=>`${e}: ${JSON.stringify(t)}`);return i&&s.push(`fixtures`),a.push(`createSimulator({ ${s.join(`, `)} })`),a.join(`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const c=require(`./objectSpread2-CuluYLUL.cjs`),l=require(`./asyncToGenerator-DANjdFmB.cjs`);let u=require(`vite`),d=require(`path`);d=s(d);let f=require(`fs`);f=s(f);function p(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function m(e,t){if(e==null)return{};var n,r,i=p(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var h=[`fixturesGlob`],g=`/@puzzmo-simulator-init.js`,_=`virtual:puzzmo-simulator`;function v(e){let t=new Map,n=D(e,3);f.default.existsSync(d.default.join(e,`puzzmo.json`))&&n.unshift(e);for(let i of n)try{var r;let n=JSON.parse(f.default.readFileSync(d.default.join(i,`puzzmo.json`),`utf-8`));if(!(!(n==null||(r=n.game)==null)&&r.slug))continue;let a=w(i,`src/appBundle`),o=null;a&&(o=`/`+d.default.relative(e,a).split(d.default.sep).join(`/`)),t.set(n.game.slug,{dir:i,slug:n.game.slug,displayName:n.game.displayName,appBundlePath:o})}catch(e){}return t}function y(e,t,n){if(e)try{let r=new URL(e).pathname;for(let e of t.values()){let t=`/`+d.default.relative(n,e.dir).split(d.default.sep).join(`/`);if(r.startsWith(t+`/`)||r===t)return e}}catch(e){}if(t.size===1)return t.values().next().value}function b(e,t){let{fixturesGlob:n}=e,r=m(e,h),i=n===!1?null:n==null?`/fixtures/puzzles/**/*.{json,toml}`:n,a=[`import { createSimulator } from "@puzzmo/sdk/simulator"`];i&&a.push(`const fixtures = import.meta.glob(${JSON.stringify(i)}, { query: "?raw", import: "default", eager: true })`),t!=null&&t.appBundlePath&&(a.push(`import(${JSON.stringify(t.appBundlePath)}).then(m => {`),a.push(` if (m.renderThumbnail) globalThis.renderThumbnail = m.renderThumbnail`),a.push(` if (m.getShareString) globalThis.getShareString = m.getShareString`),a.push(`}).catch(() => {})`));let o=c.t(c.t({},r),t!=null&&t.slug?{slug:t.slug}:{}),s=Object.entries(o).filter(([,e])=>e!==void 0).map(([e,t])=>`${e}: ${JSON.stringify(t)}`);return i&&s.push(`fixtures`),a.push(`createSimulator({ ${s.join(`, `)} })`),a.join(`
2
2
  `)}function x(e={}){let t=new Map,n;return{name:`puzzmo-simulator`,apply:`serve`,configResolved(e){if(n=e.root,t=v(n),t.size===0)e.logger.info(`\x1B[33m\x1B[1m PUZZMO \x1B[22m\x1B[39m\x1B[2m no puzzmo.json files found\x1B[22m`);else{let n=[...t.values()].map(e=>`\x1b[36m${e.slug}\x1b[39m`),r=t.size===1?`game`:`games`;e.logger.info(`\x1b[33m\x1b[1m PUZZMO \x1b[22m\x1b[39m found ${t.size} ${r}: ${n.join(`\x1B[2m, \x1B[22m`)}`)}},resolveId(e){if(e===_||e.startsWith(_+`?`))return`\0`+e},load(n){if(!n.startsWith(`\0`+_))return;let r=new URLSearchParams(n.split(`?`)[1]||``).get(`game`);return b(e,r?t.get(r):t.size===1?t.values().next().value:void 0)},configureServer(e){e.middlewares.use(`/oauth/callback`,(e,t)=>{t.setHeader(`Content-Type`,`text/html`),t.end(`<!DOCTYPE html>
3
3
  <html><head><title>Puzzmo OAuth</title></head>
4
4
  <body><script>
package/dist/vite.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"vite.cjs","names":[],"sources":["../src/vite.ts"],"sourcesContent":["import type { Plugin, ResolvedConfig } from \"vite\"\nimport { build } from \"vite\"\nimport path from \"path\"\nimport fs from \"fs\"\nimport type { HostContext } from \"./types\"\nimport type { HostContextPreset } from \"./simulator/types\"\n\nexport type PuzzmoSimulatorPluginOptions = {\n /** Whether to auto-start the game after READY (default: true) */\n autoStart?: boolean\n /** Initial collapsed state (default: true) */\n collapsed?: boolean\n /**\n * Glob pattern for fixture files, passed to import.meta.glob which is relative to the closest puzzmo.json. Defaults\n * to `\"/fixtures/puzzles/**\\/*.{json,toml}\"`. Fixtures are loaded as raw strings (any text format works — JSON,\n * TOML, or a custom format) and delivered to the game verbatim, so the game parses them itself. Pass false to disable.\n */\n fixturesGlob?: string | false\n /**\n * The `hostContext` array the simulator sends in READY_DATA, so host-context-dependent features\n * (embed settings, sandbox mode, mobile layout, …) can be exercised locally. Must be\n * JSON-serializable. Defaults to a single desktop \"app\" context; the simulator's Host tab can\n * override it at runtime (persisted per-browser, applied on restart).\n *\n * @internal\n */\n hostContext?: HostContext[]\n /**\n * Extra named `hostContext` presets for the simulator's Host tab, alongside the generic\n * built-ins — how a game ships its own scenarios (e.g. crossword's partner-embed toolbar\n * settings). Must be JSON-serializable.\n *\n * @internal\n */\n hostContextPresets?: HostContextPreset[]\n}\n\nconst simulatorURL = \"/@puzzmo-simulator-init.js\"\nconst virtualID = \"virtual:puzzmo-simulator\"\n\n/** @internal */\nexport type GameInfo = {\n /** Directory containing the puzzmo.json */\n dir: string\n slug: string\n displayName: string\n /** Vite-root-relative path to app bundle entry, if it exists */\n appBundlePath: string | null\n}\n\n/**\n * Discover all games from puzzmo.json files under a root directory.\n *\n * @internal\n */\nexport function discoverGames(viteRoot: string): Map<string, GameInfo> {\n const games = new Map<string, GameInfo>()\n const candidates = findPuzzmoJsonDirs(viteRoot, 3)\n if (fs.existsSync(path.join(viteRoot, \"puzzmo.json\"))) {\n candidates.unshift(viteRoot)\n }\n for (const dir of candidates) {\n try {\n const data = JSON.parse(fs.readFileSync(path.join(dir, \"puzzmo.json\"), \"utf-8\"))\n if (!data?.game?.slug) continue\n const bundleEntry = resolveBundleEntry(dir, \"src/appBundle\")\n let appBundle: string | null = null\n if (bundleEntry) {\n const relative = path.relative(viteRoot, bundleEntry)\n appBundle = \"/\" + relative.split(path.sep).join(\"/\")\n }\n games.set(data.game.slug, { dir, slug: data.game.slug, displayName: data.game.displayName, appBundlePath: appBundle })\n } catch {\n // skip invalid files\n }\n }\n return games\n}\n\n/**\n * Resolve which game a request belongs to using the referer URL.\n *\n * @internal\n */\nexport function resolveGameFromReferer(referer: string | undefined, games: Map<string, GameInfo>, viteRoot: string): GameInfo | undefined {\n if (referer) {\n try {\n const refPath = new URL(referer).pathname\n for (const g of games.values()) {\n const relDir = \"/\" + path.relative(viteRoot, g.dir).split(path.sep).join(\"/\")\n if (refPath.startsWith(relDir + \"/\") || refPath === relDir) return g\n }\n } catch {\n // ignore malformed referer\n }\n }\n if (games.size === 1) return games.values().next().value\n return undefined\n}\n\n/**\n * Generate the virtual module code for the simulator.\n *\n * @internal\n */\nexport function generateSimulatorCode(options: PuzzmoSimulatorPluginOptions, game: GameInfo | undefined): string {\n const { fixturesGlob: fixturesOpt, ...config } = options\n const fixturesGlob = fixturesOpt === false ? null : (fixturesOpt ?? \"/fixtures/puzzles/**/*.{json,toml}\")\n\n const lines = [`import { createSimulator } from \"@puzzmo/sdk/simulator\"`]\n\n // Load fixtures as raw strings so any text format reaches the game verbatim; the game does its own parsing.\n if (fixturesGlob) {\n lines.push(`const fixtures = import.meta.glob(${JSON.stringify(fixturesGlob)}, { query: \"?raw\", import: \"default\", eager: true })`)\n }\n\n if (game?.appBundlePath) {\n lines.push(`import(${JSON.stringify(game.appBundlePath)}).then(m => {`)\n lines.push(` if (m.renderThumbnail) globalThis.renderThumbnail = m.renderThumbnail`)\n lines.push(`}).catch(() => {})`)\n }\n\n const simConfig = { ...config, ...(game?.slug ? { slug: game.slug } : {}) }\n const configEntries = Object.entries(simConfig).filter(([, v]) => v !== undefined)\n const configParts = configEntries.map(([k, v]) => `${k}: ${JSON.stringify(v)}`)\n if (fixturesGlob) configParts.push(\"fixtures\")\n\n lines.push(`createSimulator({ ${configParts.join(\", \")} })`)\n\n return lines.join(\"\\n\")\n}\n\n/** Vite plugin that injects the Puzzmo simulator in dev mode and handles OAuth callbacks. */\nexport function puzzmoSimulator(options: PuzzmoSimulatorPluginOptions = {}): Plugin {\n let games = new Map<string, GameInfo>()\n let viteRoot: string\n\n return {\n name: \"puzzmo-simulator\",\n apply: \"serve\",\n\n configResolved(config: ResolvedConfig) {\n viteRoot = config.root\n games = discoverGames(viteRoot)\n\n if (games.size === 0) {\n config.logger.info(`\\x1b[33m\\x1b[1m PUZZMO \\x1b[22m\\x1b[39m\\x1b[2m no puzzmo.json files found\\x1b[22m`)\n } else {\n const names = [...games.values()].map((g) => `\\x1b[36m${g.slug}\\x1b[39m`)\n const label = games.size === 1 ? \"game\" : \"games\"\n config.logger.info(`\\x1b[33m\\x1b[1m PUZZMO \\x1b[22m\\x1b[39m found ${games.size} ${label}: ${names.join(\"\\x1b[2m, \\x1b[22m\")}`)\n }\n },\n\n resolveId(id) {\n if (id === virtualID || id.startsWith(virtualID + \"?\")) return \"\\0\" + id\n },\n\n load(id) {\n if (!id.startsWith(\"\\0\" + virtualID)) return\n const params = new URLSearchParams(id.split(\"?\")[1] || \"\")\n const gameSlug = params.get(\"game\")\n const game = gameSlug ? games.get(gameSlug) : games.size === 1 ? games.values().next().value : undefined\n return generateSimulatorCode(options, game)\n },\n\n configureServer(server) {\n server.middlewares.use(\"/oauth/callback\", (_req, res) => {\n res.setHeader(\"Content-Type\", \"text/html\")\n res.end(`<!DOCTYPE html>\n<html><head><title>Puzzmo OAuth</title></head>\n<body><script>\nvar params = new URLSearchParams(window.location.search);\nvar returnUrl = sessionStorage.getItem(\"oauth_return_url\") || \"/\";\nvar url = new URL(returnUrl);\nparams.forEach(function(v, k) { url.searchParams.set(k, v); });\nwindow.location.href = url.toString();\n</script></body></html>`)\n })\n\n // Serve the simulator init module, resolving the game from the referer\n server.middlewares.use(async (req, res, next) => {\n if (req.url?.split(\"?\")[0] !== simulatorURL) return next()\n\n const game = resolveGameFromReferer(req.headers.referer, games, viteRoot)\n const moduleID = virtualID + (game ? `?game=${game.slug}` : \"\")\n const result = await server.transformRequest(moduleID)\n if (!result) return next()\n res.setHeader(\"Content-Type\", \"application/javascript\")\n res.end(result.code)\n })\n },\n\n transformIndexHtml() {\n return [\n {\n tag: \"script\",\n attrs: { type: \"module\", src: simulatorURL },\n injectTo: \"head\",\n },\n ]\n },\n }\n}\n\ntype BundlePluginOptions = {\n /** Entry file for the bundle */\n entry: string\n /** Output file name */\n outputFile: string\n}\n\nfunction createBundlePlugin(pluginName: string, defaults: BundlePluginOptions) {\n return (options: Partial<BundlePluginOptions> = {}): Plugin => {\n const { entry, outputFile } = { ...defaults, ...options }\n return {\n name: pluginName,\n apply: \"build\",\n async closeBundle() {\n // If the caller overrode `entry`, honor it as-is. Otherwise try `.js` first, then `.ts`.\n const resolvedEntry = options.entry\n ? path.isAbsolute(entry)\n ? entry\n : path.resolve(process.cwd(), entry)\n : (resolveBundleEntry(process.cwd(), stripBundleExt(entry)) ?? path.resolve(process.cwd(), entry))\n try {\n await build({\n configFile: false,\n logLevel: \"warn\",\n build: {\n lib: {\n entry: resolvedEntry,\n formats: [\"es\"],\n fileName: () => outputFile,\n },\n outDir: \"dist\",\n emptyOutDir: false,\n },\n })\n } catch (error) {\n console.error(`[${pluginName}] build failed:`, error)\n throw error\n }\n },\n }\n }\n}\n\n/** Strip the trailing extension from a default entry path so we can probe siblings. */\nconst stripBundleExt = (p: string) => p.replace(/\\.[jt]sx?$/i, \"\")\n\n/** Returns the absolute path to the first matching extension under `dir`, or null. */\nconst resolveBundleEntry = (dir: string, baseRelative: string): string | null => {\n for (const ext of [\".js\", \".ts\"]) {\n const candidate = path.join(dir, baseRelative + ext)\n if (fs.existsSync(candidate)) return candidate\n }\n return null\n}\n\nexport type AppBundlePluginOptions = Partial<BundlePluginOptions>\n\n/**\n * Vite plugin that produces dist/app-bundle.js after the main build for app-level integrations.\n *\n * The bundle exports `renderThumbnail(puzzleStr, inputStr?, config?)` — a pure renderer\n * returning the SVG and its dimensions (`{ svg, width, height }`), used by the Puzzmo\n * platform for puzzle previews.\n */\nexport const appBundlePlugin = createBundlePlugin(\"app-bundle\", { entry: \"src/appBundle.js\", outputFile: \"app-bundle.js\" })\n\nexport type EditorBundlePluginOptions = Partial<BundlePluginOptions>\n\n/** Vite plugin that produces dist/editor-bundle.js after the main build for editor-level integrations. */\nexport const editorBundlePlugin = createBundlePlugin(\"editor-bundle\", { entry: \"src/editorBundle.js\", outputFile: \"editor-bundle.js\" })\n\n/**\n * Recursively find directories containing puzzmo.json, up to `maxDepth` levels deep.\n *\n * @internal\n */\nexport const findPuzzmoJsonDirs = (root: string, maxDepth: number, depth = 0): string[] => {\n if (depth >= maxDepth) return []\n const results: string[] = []\n let entries: fs.Dirent[]\n try {\n entries = fs.readdirSync(root, { withFileTypes: true })\n } catch {\n return results\n }\n for (const entry of entries) {\n if (!entry.isDirectory() || entry.name.startsWith(\".\") || entry.name === \"node_modules\") continue\n const dir = path.join(root, entry.name)\n if (fs.existsSync(path.join(dir, \"puzzmo.json\"))) {\n results.push(dir)\n }\n results.push(...findPuzzmoJsonDirs(dir, maxDepth, depth + 1))\n }\n return results\n}\n"],"mappings":"yjCA0GU,eAAA,CArEJ,EAAe,6BACf,EAAY,2BAiBlB,SAAgB,EAAc,EAAyC,CACrE,IAAM,EAAQ,IAAI,IACZ,EAAa,EAAmB,EAAU,EAAE,CAC9C,EAAA,QAAG,WAAW,EAAA,QAAK,KAAK,EAAU,cAAc,CAAC,EACnD,EAAW,QAAQ,EAAS,CAE9B,IAAK,IAAM,KAAO,EAChB,GAAI,OACF,IAAM,EAAO,KAAK,MAAM,EAAA,QAAG,aAAa,EAAA,QAAK,KAAK,EAAK,cAAc,CAAE,QAAQ,CAAC,CAChF,GAAI,EAAA,KAAA,OAAA,EAAC,EAAM,OAAA,OAAA,EAAM,MAAM,SACvB,IAAM,EAAc,EAAmB,EAAK,gBAAgB,CACxD,EAA2B,KAC3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AAM,IAAO,CAAC,MAAO,MAAM,CAAE,CAChC,IAAM,EAAY,EAAA,QAAK,KAAK,EAAK,EAAe,EAAI,CACpD,GAAI,EAAA,QAAG,WAAW,EAAU,CAAE,OAAO,EAEvC,OAAO,MAYT,MAAa,EAAkB,EAAmB,aAAc,CAAE,MAAO,mBAAoB,WAAY,gBAAiB,CAAC,CAK9G,EAAqB,EAAmB,gBAAiB,CAAE,MAAO,sBAAuB,WAAY,mBAAoB,CAAC,CAO1H,GAAsB,EAAc,EAAkB,EAAQ,IAAgB,CACzF,GAAI,GAAS,EAAU,MAAO,EAAE,CAChC,IAAM,EAAoB,EAAE,CACxB,EACJ,GAAI,CACF,EAAU,EAAA,QAAG,YAAY,EAAM,CAAE,cAAe,GAAM,CAAC,SACjD,CACN,OAAO,EAET,IAAK,IAAM,KAAS,EAAS,CAC3B,GAAI,CAAC,EAAM,aAAa,EAAI,EAAM,KAAK,WAAW,IAAI,EAAI,EAAM,OAAS,eAAgB,SACzF,IAAM,EAAM,EAAA,QAAK,KAAK,EAAM,EAAM,KAAK,CACnC,EAAA,QAAG,WAAW,EAAA,QAAK,KAAK,EAAK,cAAc,CAAC,EAC9C,EAAQ,KAAK,EAAI,CAEnB,EAAQ,KAAK,GAAG,EAAmB,EAAK,EAAU,EAAQ,EAAE,CAAC,CAE/D,OAAO"}
1
+ {"version":3,"file":"vite.cjs","names":[],"sources":["../src/vite.ts"],"sourcesContent":["import type { Plugin, ResolvedConfig } from \"vite\"\nimport { build } from \"vite\"\nimport path from \"path\"\nimport fs from \"fs\"\nimport type { HostContext } from \"./types\"\nimport type { HostContextPreset } from \"./simulator/types\"\n\nexport type PuzzmoSimulatorPluginOptions = {\n /** Whether to auto-start the game after READY (default: true) */\n autoStart?: boolean\n /** Initial collapsed state (default: true) */\n collapsed?: boolean\n /**\n * Glob pattern for fixture files, passed to import.meta.glob which is relative to the closest puzzmo.json. Defaults\n * to `\"/fixtures/puzzles/**\\/*.{json,toml}\"`. Fixtures are loaded as raw strings (any text format works — JSON,\n * TOML, or a custom format) and delivered to the game verbatim, so the game parses them itself. Pass false to disable.\n */\n fixturesGlob?: string | false\n /**\n * The `hostContext` array the simulator sends in READY_DATA, so host-context-dependent features\n * (embed settings, sandbox mode, mobile layout, …) can be exercised locally. Must be\n * JSON-serializable. Defaults to a single desktop \"app\" context; the simulator's Host tab can\n * override it at runtime (persisted per-browser, applied on restart).\n *\n * @internal\n */\n hostContext?: HostContext[]\n /**\n * Extra named `hostContext` presets for the simulator's Host tab, alongside the generic\n * built-ins — how a game ships its own scenarios (e.g. crossword's partner-embed toolbar\n * settings). Must be JSON-serializable.\n *\n * @internal\n */\n hostContextPresets?: HostContextPreset[]\n}\n\nconst simulatorURL = \"/@puzzmo-simulator-init.js\"\nconst virtualID = \"virtual:puzzmo-simulator\"\n\n/** @internal */\nexport type GameInfo = {\n /** Directory containing the puzzmo.json */\n dir: string\n slug: string\n displayName: string\n /** Vite-root-relative path to app bundle entry, if it exists */\n appBundlePath: string | null\n}\n\n/**\n * Discover all games from puzzmo.json files under a root directory.\n *\n * @internal\n */\nexport function discoverGames(viteRoot: string): Map<string, GameInfo> {\n const games = new Map<string, GameInfo>()\n const candidates = findPuzzmoJsonDirs(viteRoot, 3)\n if (fs.existsSync(path.join(viteRoot, \"puzzmo.json\"))) {\n candidates.unshift(viteRoot)\n }\n for (const dir of candidates) {\n try {\n const data = JSON.parse(fs.readFileSync(path.join(dir, \"puzzmo.json\"), \"utf-8\"))\n if (!data?.game?.slug) continue\n const bundleEntry = resolveBundleEntry(dir, \"src/appBundle\")\n let appBundle: string | null = null\n if (bundleEntry) {\n const relative = path.relative(viteRoot, bundleEntry)\n appBundle = \"/\" + relative.split(path.sep).join(\"/\")\n }\n games.set(data.game.slug, { dir, slug: data.game.slug, displayName: data.game.displayName, appBundlePath: appBundle })\n } catch {\n // skip invalid files\n }\n }\n return games\n}\n\n/**\n * Resolve which game a request belongs to using the referer URL.\n *\n * @internal\n */\nexport function resolveGameFromReferer(referer: string | undefined, games: Map<string, GameInfo>, viteRoot: string): GameInfo | undefined {\n if (referer) {\n try {\n const refPath = new URL(referer).pathname\n for (const g of games.values()) {\n const relDir = \"/\" + path.relative(viteRoot, g.dir).split(path.sep).join(\"/\")\n if (refPath.startsWith(relDir + \"/\") || refPath === relDir) return g\n }\n } catch {\n // ignore malformed referer\n }\n }\n if (games.size === 1) return games.values().next().value\n return undefined\n}\n\n/**\n * Generate the virtual module code for the simulator.\n *\n * @internal\n */\nexport function generateSimulatorCode(options: PuzzmoSimulatorPluginOptions, game: GameInfo | undefined): string {\n const { fixturesGlob: fixturesOpt, ...config } = options\n const fixturesGlob = fixturesOpt === false ? null : (fixturesOpt ?? \"/fixtures/puzzles/**/*.{json,toml}\")\n\n const lines = [`import { createSimulator } from \"@puzzmo/sdk/simulator\"`]\n\n // Load fixtures as raw strings so any text format reaches the game verbatim; the game does its own parsing.\n if (fixturesGlob) {\n lines.push(`const fixtures = import.meta.glob(${JSON.stringify(fixturesGlob)}, { query: \"?raw\", import: \"default\", eager: true })`)\n }\n\n if (game?.appBundlePath) {\n lines.push(`import(${JSON.stringify(game.appBundlePath)}).then(m => {`)\n lines.push(` if (m.renderThumbnail) globalThis.renderThumbnail = m.renderThumbnail`)\n lines.push(` if (m.getShareString) globalThis.getShareString = m.getShareString`)\n lines.push(`}).catch(() => {})`)\n }\n\n const simConfig = { ...config, ...(game?.slug ? { slug: game.slug } : {}) }\n const configEntries = Object.entries(simConfig).filter(([, v]) => v !== undefined)\n const configParts = configEntries.map(([k, v]) => `${k}: ${JSON.stringify(v)}`)\n if (fixturesGlob) configParts.push(\"fixtures\")\n\n lines.push(`createSimulator({ ${configParts.join(\", \")} })`)\n\n return lines.join(\"\\n\")\n}\n\n/** Vite plugin that injects the Puzzmo simulator in dev mode and handles OAuth callbacks. */\nexport function puzzmoSimulator(options: PuzzmoSimulatorPluginOptions = {}): Plugin {\n let games = new Map<string, GameInfo>()\n let viteRoot: string\n\n return {\n name: \"puzzmo-simulator\",\n apply: \"serve\",\n\n configResolved(config: ResolvedConfig) {\n viteRoot = config.root\n games = discoverGames(viteRoot)\n\n if (games.size === 0) {\n config.logger.info(`\\x1b[33m\\x1b[1m PUZZMO \\x1b[22m\\x1b[39m\\x1b[2m no puzzmo.json files found\\x1b[22m`)\n } else {\n const names = [...games.values()].map((g) => `\\x1b[36m${g.slug}\\x1b[39m`)\n const label = games.size === 1 ? \"game\" : \"games\"\n config.logger.info(`\\x1b[33m\\x1b[1m PUZZMO \\x1b[22m\\x1b[39m found ${games.size} ${label}: ${names.join(\"\\x1b[2m, \\x1b[22m\")}`)\n }\n },\n\n resolveId(id) {\n if (id === virtualID || id.startsWith(virtualID + \"?\")) return \"\\0\" + id\n },\n\n load(id) {\n if (!id.startsWith(\"\\0\" + virtualID)) return\n const params = new URLSearchParams(id.split(\"?\")[1] || \"\")\n const gameSlug = params.get(\"game\")\n const game = gameSlug ? games.get(gameSlug) : games.size === 1 ? games.values().next().value : undefined\n return generateSimulatorCode(options, game)\n },\n\n configureServer(server) {\n server.middlewares.use(\"/oauth/callback\", (_req, res) => {\n res.setHeader(\"Content-Type\", \"text/html\")\n res.end(`<!DOCTYPE html>\n<html><head><title>Puzzmo OAuth</title></head>\n<body><script>\nvar params = new URLSearchParams(window.location.search);\nvar returnUrl = sessionStorage.getItem(\"oauth_return_url\") || \"/\";\nvar url = new URL(returnUrl);\nparams.forEach(function(v, k) { url.searchParams.set(k, v); });\nwindow.location.href = url.toString();\n</script></body></html>`)\n })\n\n // Serve the simulator init module, resolving the game from the referer\n server.middlewares.use(async (req, res, next) => {\n if (req.url?.split(\"?\")[0] !== simulatorURL) return next()\n\n const game = resolveGameFromReferer(req.headers.referer, games, viteRoot)\n const moduleID = virtualID + (game ? `?game=${game.slug}` : \"\")\n const result = await server.transformRequest(moduleID)\n if (!result) return next()\n res.setHeader(\"Content-Type\", \"application/javascript\")\n res.end(result.code)\n })\n },\n\n transformIndexHtml() {\n return [\n {\n tag: \"script\",\n attrs: { type: \"module\", src: simulatorURL },\n injectTo: \"head\",\n },\n ]\n },\n }\n}\n\ntype BundlePluginOptions = {\n /** Entry file for the bundle */\n entry: string\n /** Output file name */\n outputFile: string\n}\n\nfunction createBundlePlugin(pluginName: string, defaults: BundlePluginOptions) {\n return (options: Partial<BundlePluginOptions> = {}): Plugin => {\n const { entry, outputFile } = { ...defaults, ...options }\n return {\n name: pluginName,\n apply: \"build\",\n async closeBundle() {\n // If the caller overrode `entry`, honor it as-is. Otherwise try `.js` first, then `.ts`.\n const resolvedEntry = options.entry\n ? path.isAbsolute(entry)\n ? entry\n : path.resolve(process.cwd(), entry)\n : (resolveBundleEntry(process.cwd(), stripBundleExt(entry)) ?? path.resolve(process.cwd(), entry))\n try {\n await build({\n configFile: false,\n logLevel: \"warn\",\n build: {\n lib: {\n entry: resolvedEntry,\n formats: [\"es\"],\n fileName: () => outputFile,\n },\n outDir: \"dist\",\n emptyOutDir: false,\n },\n })\n } catch (error) {\n console.error(`[${pluginName}] build failed:`, error)\n throw error\n }\n },\n }\n }\n}\n\n/** Strip the trailing extension from a default entry path so we can probe siblings. */\nconst stripBundleExt = (p: string) => p.replace(/\\.[jt]sx?$/i, \"\")\n\n/** Returns the absolute path to the first matching extension under `dir`, or null. */\nconst resolveBundleEntry = (dir: string, baseRelative: string): string | null => {\n for (const ext of [\".js\", \".ts\"]) {\n const candidate = path.join(dir, baseRelative + ext)\n if (fs.existsSync(candidate)) return candidate\n }\n return null\n}\n\nexport type AppBundlePluginOptions = {\n /** Entry file for the app bundle (default: `src/appBundle.js`) */\n entry?: string\n /** Output file name (default: `app-bundle.js`) */\n outputFile?: string\n}\n\n/**\n * Vite plugin that produces dist/app-bundle.js after the main build for app-level integrations.\n *\n * The bundle exports `renderThumbnail(puzzleStr, inputStr?, config?)` — a pure renderer\n * returning the SVG and its dimensions (`{ svg, width, height }`), used by the Puzzmo\n * platform for puzzle previews.\n */\nexport const appBundlePlugin = createBundlePlugin(\"app-bundle\", { entry: \"src/appBundle.js\", outputFile: \"app-bundle.js\" })\n\nexport type EditorBundlePluginOptions = {\n /** Entry file for the editor bundle (default: `src/editorBundle.js`) */\n entry?: string\n /** Output file name (default: `editor-bundle.js`) */\n outputFile?: string\n}\n\n/** Vite plugin that produces dist/editor-bundle.js after the main build for editor-level integrations. */\nexport const editorBundlePlugin = createBundlePlugin(\"editor-bundle\", { entry: \"src/editorBundle.js\", outputFile: \"editor-bundle.js\" })\n\n/**\n * Recursively find directories containing puzzmo.json, up to `maxDepth` levels deep.\n *\n * @internal\n */\nexport const findPuzzmoJsonDirs = (root: string, maxDepth: number, depth = 0): string[] => {\n if (depth >= maxDepth) return []\n const results: string[] = []\n let entries: fs.Dirent[]\n try {\n entries = fs.readdirSync(root, { withFileTypes: true })\n } catch {\n return results\n }\n for (const entry of entries) {\n if (!entry.isDirectory() || entry.name.startsWith(\".\") || entry.name === \"node_modules\") continue\n const dir = path.join(root, entry.name)\n if (fs.existsSync(path.join(dir, \"puzzmo.json\"))) {\n results.push(dir)\n }\n results.push(...findPuzzmoJsonDirs(dir, maxDepth, depth + 1))\n }\n return results\n}\n"],"mappings":"yjCA0GU,eAAA,CArEJ,EAAe,6BACf,EAAY,2BAiBlB,SAAgB,EAAc,EAAyC,CACrE,IAAM,EAAQ,IAAI,IACZ,EAAa,EAAmB,EAAU,EAAE,CAC9C,EAAA,QAAG,WAAW,EAAA,QAAK,KAAK,EAAU,cAAc,CAAC,EACnD,EAAW,QAAQ,EAAS,CAE9B,IAAK,IAAM,KAAO,EAChB,GAAI,OACF,IAAM,EAAO,KAAK,MAAM,EAAA,QAAG,aAAa,EAAA,QAAK,KAAK,EAAK,cAAc,CAAE,QAAQ,CAAC,CAChF,GAAI,EAAA,KAAA,OAAA,EAAC,EAAM,OAAA,OAAA,EAAM,MAAM,SACvB,IAAM,EAAc,EAAmB,EAAK,gBAAgB,CACxD,EAA2B,KAC3B,IAEF,EAAY,IADK,EAAA,QAAK,SAAS,EAAU,EAAY,CAC1B,MA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E,CAChC,IAAM,EAAY,EAAA,QAAK,KAAK,EAAK,EAAe,EAAI,CACpD,GAAI,EAAA,QAAG,WAAW,EAAU,CAAE,OAAO,EAEvC,OAAO,MAiBT,MAAa,EAAkB,EAAmB,aAAc,CAAE,MAAO,mBAAoB,WAAY,gBAAiB,CAAC,CAU9G,EAAqB,EAAmB,gBAAiB,CAAE,MAAO,sBAAuB,WAAY,mBAAoB,CAAC,CAO1H,GAAsB,EAAc,EAAkB,EAAQ,IAAgB,CACzF,GAAI,GAAS,EAAU,MAAO,EAAE,CAChC,IAAM,EAAoB,EAAE,CACxB,EACJ,GAAI,CACF,EAAU,EAAA,QAAG,YAAY,EAAM,CAAE,cAAe,GAAM,CAAC,SACjD,CACN,OAAO,EAET,IAAK,IAAM,KAAS,EAAS,CAC3B,GAAI,CAAC,EAAM,aAAa,EAAI,EAAM,KAAK,WAAW,IAAI,EAAI,EAAM,OAAS,eAAgB,SACzF,IAAM,EAAM,EAAA,QAAK,KAAK,EAAM,EAAM,KAAK,CACnC,EAAA,QAAG,WAAW,EAAA,QAAK,KAAK,EAAK,cAAc,CAAC,EAC9C,EAAQ,KAAK,EAAI,CAEnB,EAAQ,KAAK,GAAG,EAAmB,EAAK,EAAU,EAAQ,EAAE,CAAC,CAE/D,OAAO"}
package/dist/vite.d.ts CHANGED
@@ -65,7 +65,12 @@ type BundlePluginOptions = {
65
65
  /** Output file name */
66
66
  outputFile: string;
67
67
  };
68
- export type AppBundlePluginOptions = Partial<BundlePluginOptions>;
68
+ export type AppBundlePluginOptions = {
69
+ /** Entry file for the app bundle (default: `src/appBundle.js`) */
70
+ entry?: string;
71
+ /** Output file name (default: `app-bundle.js`) */
72
+ outputFile?: string;
73
+ };
69
74
  /**
70
75
  * Vite plugin that produces dist/app-bundle.js after the main build for app-level integrations.
71
76
  *
@@ -74,7 +79,12 @@ export type AppBundlePluginOptions = Partial<BundlePluginOptions>;
74
79
  * platform for puzzle previews.
75
80
  */
76
81
  export declare const appBundlePlugin: (options?: Partial<BundlePluginOptions>) => Plugin<any>;
77
- export type EditorBundlePluginOptions = Partial<BundlePluginOptions>;
82
+ export type EditorBundlePluginOptions = {
83
+ /** Entry file for the editor bundle (default: `src/editorBundle.js`) */
84
+ entry?: string;
85
+ /** Output file name (default: `editor-bundle.js`) */
86
+ outputFile?: string;
87
+ };
78
88
  /** Vite plugin that produces dist/editor-bundle.js after the main build for editor-level integrations. */
79
89
  export declare const editorBundlePlugin: (options?: Partial<BundlePluginOptions>) => Plugin<any>;
80
90
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,MAAM,CAAA;AAIlD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE1D,MAAM,MAAM,4BAA4B,GAAG;IACzC,iEAAiE;IACjE,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,KAAK,CAAA;IAC7B;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,WAAW,EAAE,CAAA;IAC3B;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,CAAA;CACzC,CAAA;AAKD,gBAAgB;AAChB,MAAM,MAAM,QAAQ,GAAG;IACrB,2CAA2C;IAC3C,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,gEAAgE;IAChE,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;CAC7B,CAAA;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,QAAQ,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AAM,yBAAyB,GAAG;IACtC,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,qDAAqD;IACrD,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,0GAA0G;AAC1G,eAAO,MAAM,kBAAkB,yDAAwG,CAAA;AAEvI;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,8DAkB9B,CAAA"}
package/dist/vite.js CHANGED
@@ -66,7 +66,7 @@ function d(e, t, n) {
66
66
  */
67
67
  function f(t, n) {
68
68
  let { fixturesGlob: r } = t, i = o(t, s), a = r === !1 ? null : r == null ? "/fixtures/puzzles/**/*.{json,toml}" : r, c = ["import { createSimulator } from \"@puzzmo/sdk/simulator\""];
69
- a && c.push(`const fixtures = import.meta.glob(${JSON.stringify(a)}, { query: "?raw", import: "default", eager: true })`), n != null && n.appBundlePath && (c.push(`import(${JSON.stringify(n.appBundlePath)}).then(m => {`), c.push(" if (m.renderThumbnail) globalThis.renderThumbnail = m.renderThumbnail"), c.push("}).catch(() => {})"));
69
+ a && c.push(`const fixtures = import.meta.glob(${JSON.stringify(a)}, { query: "?raw", import: "default", eager: true })`), n != null && n.appBundlePath && (c.push(`import(${JSON.stringify(n.appBundlePath)}).then(m => {`), c.push(" if (m.renderThumbnail) globalThis.renderThumbnail = m.renderThumbnail"), c.push(" if (m.getShareString) globalThis.getShareString = m.getShareString"), c.push("}).catch(() => {})"));
70
70
  let l = e(e({}, i), n != null && n.slug ? { slug: n.slug } : {}), u = Object.entries(l).filter(([, e]) => e !== void 0).map(([e, t]) => `${e}: ${JSON.stringify(t)}`);
71
71
  return a && u.push("fixtures"), c.push(`createSimulator({ ${u.join(", ")} })`), c.join("\n");
72
72
  }
package/dist/vite.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"vite.js","names":[],"sources":["../src/vite.ts"],"sourcesContent":["import type { Plugin, ResolvedConfig } from \"vite\"\nimport { build } from \"vite\"\nimport path from \"path\"\nimport fs from \"fs\"\nimport type { HostContext } from \"./types\"\nimport type { HostContextPreset } from \"./simulator/types\"\n\nexport type PuzzmoSimulatorPluginOptions = {\n /** Whether to auto-start the game after READY (default: true) */\n autoStart?: boolean\n /** Initial collapsed state (default: true) */\n collapsed?: boolean\n /**\n * Glob pattern for fixture files, passed to import.meta.glob which is relative to the closest puzzmo.json. Defaults\n * to `\"/fixtures/puzzles/**\\/*.{json,toml}\"`. Fixtures are loaded as raw strings (any text format works — JSON,\n * TOML, or a custom format) and delivered to the game verbatim, so the game parses them itself. Pass false to disable.\n */\n fixturesGlob?: string | false\n /**\n * The `hostContext` array the simulator sends in READY_DATA, so host-context-dependent features\n * (embed settings, sandbox mode, mobile layout, …) can be exercised locally. Must be\n * JSON-serializable. Defaults to a single desktop \"app\" context; the simulator's Host tab can\n * override it at runtime (persisted per-browser, applied on restart).\n *\n * @internal\n */\n hostContext?: HostContext[]\n /**\n * Extra named `hostContext` presets for the simulator's Host tab, alongside the generic\n * built-ins — how a game ships its own scenarios (e.g. crossword's partner-embed toolbar\n * settings). Must be JSON-serializable.\n *\n * @internal\n */\n hostContextPresets?: HostContextPreset[]\n}\n\nconst simulatorURL = \"/@puzzmo-simulator-init.js\"\nconst virtualID = \"virtual:puzzmo-simulator\"\n\n/** @internal */\nexport type GameInfo = {\n /** Directory containing the puzzmo.json */\n dir: string\n slug: string\n displayName: string\n /** Vite-root-relative path to app bundle entry, if it exists */\n appBundlePath: string | null\n}\n\n/**\n * Discover all games from puzzmo.json files under a root directory.\n *\n * @internal\n */\nexport function discoverGames(viteRoot: string): Map<string, GameInfo> {\n const games = new Map<string, GameInfo>()\n const candidates = findPuzzmoJsonDirs(viteRoot, 3)\n if (fs.existsSync(path.join(viteRoot, \"puzzmo.json\"))) {\n candidates.unshift(viteRoot)\n }\n for (const dir of candidates) {\n try {\n const data = JSON.parse(fs.readFileSync(path.join(dir, \"puzzmo.json\"), \"utf-8\"))\n if (!data?.game?.slug) continue\n const bundleEntry = resolveBundleEntry(dir, \"src/appBundle\")\n let appBundle: string | null = null\n if (bundleEntry) {\n const relative = path.relative(viteRoot, bundleEntry)\n appBundle = \"/\" + relative.split(path.sep).join(\"/\")\n }\n games.set(data.game.slug, { dir, slug: data.game.slug, displayName: data.game.displayName, appBundlePath: appBundle })\n } catch {\n // skip invalid files\n }\n }\n return games\n}\n\n/**\n * Resolve which game a request belongs to using the referer URL.\n *\n * @internal\n */\nexport function resolveGameFromReferer(referer: string | undefined, games: Map<string, GameInfo>, viteRoot: string): GameInfo | undefined {\n if (referer) {\n try {\n const refPath = new URL(referer).pathname\n for (const g of games.values()) {\n const relDir = \"/\" + path.relative(viteRoot, g.dir).split(path.sep).join(\"/\")\n if (refPath.startsWith(relDir + \"/\") || refPath === relDir) return g\n }\n } catch {\n // ignore malformed referer\n }\n }\n if (games.size === 1) return games.values().next().value\n return undefined\n}\n\n/**\n * Generate the virtual module code for the simulator.\n *\n * @internal\n */\nexport function generateSimulatorCode(options: PuzzmoSimulatorPluginOptions, game: GameInfo | undefined): string {\n const { fixturesGlob: fixturesOpt, ...config } = options\n const fixturesGlob = fixturesOpt === false ? null : (fixturesOpt ?? \"/fixtures/puzzles/**/*.{json,toml}\")\n\n const lines = [`import { createSimulator } from \"@puzzmo/sdk/simulator\"`]\n\n // Load fixtures as raw strings so any text format reaches the game verbatim; the game does its own parsing.\n if (fixturesGlob) {\n lines.push(`const fixtures = import.meta.glob(${JSON.stringify(fixturesGlob)}, { query: \"?raw\", import: \"default\", eager: true })`)\n }\n\n if (game?.appBundlePath) {\n lines.push(`import(${JSON.stringify(game.appBundlePath)}).then(m => {`)\n lines.push(` if (m.renderThumbnail) globalThis.renderThumbnail = m.renderThumbnail`)\n lines.push(`}).catch(() => {})`)\n }\n\n const simConfig = { ...config, ...(game?.slug ? { slug: game.slug } : {}) }\n const configEntries = Object.entries(simConfig).filter(([, v]) => v !== undefined)\n const configParts = configEntries.map(([k, v]) => `${k}: ${JSON.stringify(v)}`)\n if (fixturesGlob) configParts.push(\"fixtures\")\n\n lines.push(`createSimulator({ ${configParts.join(\", \")} })`)\n\n return lines.join(\"\\n\")\n}\n\n/** Vite plugin that injects the Puzzmo simulator in dev mode and handles OAuth callbacks. */\nexport function puzzmoSimulator(options: PuzzmoSimulatorPluginOptions = {}): Plugin {\n let games = new Map<string, GameInfo>()\n let viteRoot: string\n\n return {\n name: \"puzzmo-simulator\",\n apply: \"serve\",\n\n configResolved(config: ResolvedConfig) {\n viteRoot = config.root\n games = discoverGames(viteRoot)\n\n if (games.size === 0) {\n config.logger.info(`\\x1b[33m\\x1b[1m PUZZMO \\x1b[22m\\x1b[39m\\x1b[2m no puzzmo.json files found\\x1b[22m`)\n } else {\n const names = [...games.values()].map((g) => `\\x1b[36m${g.slug}\\x1b[39m`)\n const label = games.size === 1 ? \"game\" : \"games\"\n config.logger.info(`\\x1b[33m\\x1b[1m PUZZMO \\x1b[22m\\x1b[39m found ${games.size} ${label}: ${names.join(\"\\x1b[2m, \\x1b[22m\")}`)\n }\n },\n\n resolveId(id) {\n if (id === virtualID || id.startsWith(virtualID + \"?\")) return \"\\0\" + id\n },\n\n load(id) {\n if (!id.startsWith(\"\\0\" + virtualID)) return\n const params = new URLSearchParams(id.split(\"?\")[1] || \"\")\n const gameSlug = params.get(\"game\")\n const game = gameSlug ? games.get(gameSlug) : games.size === 1 ? games.values().next().value : undefined\n return generateSimulatorCode(options, game)\n },\n\n configureServer(server) {\n server.middlewares.use(\"/oauth/callback\", (_req, res) => {\n res.setHeader(\"Content-Type\", \"text/html\")\n res.end(`<!DOCTYPE html>\n<html><head><title>Puzzmo OAuth</title></head>\n<body><script>\nvar params = new URLSearchParams(window.location.search);\nvar returnUrl = sessionStorage.getItem(\"oauth_return_url\") || \"/\";\nvar url = new URL(returnUrl);\nparams.forEach(function(v, k) { url.searchParams.set(k, v); });\nwindow.location.href = url.toString();\n</script></body></html>`)\n })\n\n // Serve the simulator init module, resolving the game from the referer\n server.middlewares.use(async (req, res, next) => {\n if (req.url?.split(\"?\")[0] !== simulatorURL) return next()\n\n const game = resolveGameFromReferer(req.headers.referer, games, viteRoot)\n const moduleID = virtualID + (game ? `?game=${game.slug}` : \"\")\n const result = await server.transformRequest(moduleID)\n if (!result) return next()\n res.setHeader(\"Content-Type\", \"application/javascript\")\n res.end(result.code)\n })\n },\n\n transformIndexHtml() {\n return [\n {\n tag: \"script\",\n attrs: { type: \"module\", src: simulatorURL },\n injectTo: \"head\",\n },\n ]\n },\n }\n}\n\ntype BundlePluginOptions = {\n /** Entry file for the bundle */\n entry: string\n /** Output file name */\n outputFile: string\n}\n\nfunction createBundlePlugin(pluginName: string, defaults: BundlePluginOptions) {\n return (options: Partial<BundlePluginOptions> = {}): Plugin => {\n const { entry, outputFile } = { ...defaults, ...options }\n return {\n name: pluginName,\n apply: \"build\",\n async closeBundle() {\n // If the caller overrode `entry`, honor it as-is. Otherwise try `.js` first, then `.ts`.\n const resolvedEntry = options.entry\n ? path.isAbsolute(entry)\n ? entry\n : path.resolve(process.cwd(), entry)\n : (resolveBundleEntry(process.cwd(), stripBundleExt(entry)) ?? path.resolve(process.cwd(), entry))\n try {\n await build({\n configFile: false,\n logLevel: \"warn\",\n build: {\n lib: {\n entry: resolvedEntry,\n formats: [\"es\"],\n fileName: () => outputFile,\n },\n outDir: \"dist\",\n emptyOutDir: false,\n },\n })\n } catch (error) {\n console.error(`[${pluginName}] build failed:`, error)\n throw error\n }\n },\n }\n }\n}\n\n/** Strip the trailing extension from a default entry path so we can probe siblings. */\nconst stripBundleExt = (p: string) => p.replace(/\\.[jt]sx?$/i, \"\")\n\n/** Returns the absolute path to the first matching extension under `dir`, or null. */\nconst resolveBundleEntry = (dir: string, baseRelative: string): string | null => {\n for (const ext of [\".js\", \".ts\"]) {\n const candidate = path.join(dir, baseRelative + ext)\n if (fs.existsSync(candidate)) return candidate\n }\n return null\n}\n\nexport type AppBundlePluginOptions = Partial<BundlePluginOptions>\n\n/**\n * Vite plugin that produces dist/app-bundle.js after the main build for app-level integrations.\n *\n * The bundle exports `renderThumbnail(puzzleStr, inputStr?, config?)` — a pure renderer\n * returning the SVG and its dimensions (`{ svg, width, height }`), used by the Puzzmo\n * platform for puzzle previews.\n */\nexport const appBundlePlugin = createBundlePlugin(\"app-bundle\", { entry: \"src/appBundle.js\", outputFile: \"app-bundle.js\" })\n\nexport type EditorBundlePluginOptions = Partial<BundlePluginOptions>\n\n/** Vite plugin that produces dist/editor-bundle.js after the main build for editor-level integrations. */\nexport const editorBundlePlugin = createBundlePlugin(\"editor-bundle\", { entry: \"src/editorBundle.js\", outputFile: \"editor-bundle.js\" })\n\n/**\n * Recursively find directories containing puzzmo.json, up to `maxDepth` levels deep.\n *\n * @internal\n */\nexport const findPuzzmoJsonDirs = (root: string, maxDepth: number, depth = 0): string[] => {\n if (depth >= maxDepth) return []\n const results: string[] = []\n let entries: fs.Dirent[]\n try {\n entries = fs.readdirSync(root, { withFileTypes: true })\n } catch {\n return results\n }\n for (const entry of entries) {\n if (!entry.isDirectory() || entry.name.startsWith(\".\") || entry.name === \"node_modules\") continue\n const dir = path.join(root, entry.name)\n if (fs.existsSync(path.join(dir, \"puzzmo.json\"))) {\n results.push(dir)\n }\n results.push(...findPuzzmoJsonDirs(dir, maxDepth, depth + 1))\n }\n return results\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;SA0GU,eAAA,EArEJ,IAAe,8BACf,IAAY;;;;;;AAiBlB,SAAgB,EAAc,GAAyC;CACrE,IAAM,oBAAQ,IAAI,KAAuB,EACnC,IAAa,EAAmB,GAAU,EAAE;AAClD,CAAI,EAAG,WAAW,EAAK,KAAK,GAAU,cAAc,CAAC,IACnD,EAAW,QAAQ,EAAS;AAE9B,MAAK,IAAM,KAAO,EAChB,KAAI;;EACF,IAAM,IAAO,KAAK,MAAM,EAAG,aAAa,EAAK,KAAK,GAAK,cAAc,EAAE,QAAQ,CAAC;AAChF,MAAI,EAAA,OAAA,SAAA,IAAC,EAAM,SAAA,SAAA,EAAM,MAAM;EACvB,IAAM,IAAc,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AsB,GAAa,MAAwC;AAC/E,MAAK,IAAM,KAAO,CAAC,OAAO,MAAM,EAAE;EAChC,IAAM,IAAY,EAAK,KAAK,GAAK,IAAe,EAAI;AACpD,MAAI,EAAG,WAAW,EAAU,CAAE,QAAO;;AAEvC,QAAO;;;;;;;;;AAYT,MAAa,IAAkB,EAAmB,cAAc;CAAE,OAAO;CAAoB,YAAY;CAAiB,CAAC,EAK9G,IAAqB,EAAmB,iBAAiB;CAAE,OAAO;CAAuB,YAAY;CAAoB,CAAC,EAO1H,KAAsB,GAAc,GAAkB,IAAQ,MAAgB;AACzF,KAAI,KAAS,EAAU,QAAO,EAAE;CAChC,IAAM,IAAoB,EAAE,EACxB;AACJ,KAAI;AACF,MAAU,EAAG,YAAY,GAAM,EAAE,eAAe,IAAM,CAAC;aACjD;AACN,SAAO;;AAET,MAAK,IAAM,KAAS,GAAS;AAC3B,MAAI,CAAC,EAAM,aAAa,IAAI,EAAM,KAAK,WAAW,IAAI,IAAI,EAAM,SAAS,eAAgB;EACzF,IAAM,IAAM,EAAK,KAAK,GAAM,EAAM,KAAK;AAIvC,EAHI,EAAG,WAAW,EAAK,KAAK,GAAK,cAAc,CAAC,IAC9C,EAAQ,KAAK,EAAI,EAEnB,EAAQ,KAAK,GAAG,EAAmB,GAAK,GAAU,IAAQ,EAAE,CAAC;;AAE/D,QAAO"}
1
+ {"version":3,"file":"vite.js","names":[],"sources":["../src/vite.ts"],"sourcesContent":["import type { Plugin, ResolvedConfig } from \"vite\"\nimport { build } from \"vite\"\nimport path from \"path\"\nimport fs from \"fs\"\nimport type { HostContext } from \"./types\"\nimport type { HostContextPreset } from \"./simulator/types\"\n\nexport type PuzzmoSimulatorPluginOptions = {\n /** Whether to auto-start the game after READY (default: true) */\n autoStart?: boolean\n /** Initial collapsed state (default: true) */\n collapsed?: boolean\n /**\n * Glob pattern for fixture files, passed to import.meta.glob which is relative to the closest puzzmo.json. Defaults\n * to `\"/fixtures/puzzles/**\\/*.{json,toml}\"`. Fixtures are loaded as raw strings (any text format works — JSON,\n * TOML, or a custom format) and delivered to the game verbatim, so the game parses them itself. Pass false to disable.\n */\n fixturesGlob?: string | false\n /**\n * The `hostContext` array the simulator sends in READY_DATA, so host-context-dependent features\n * (embed settings, sandbox mode, mobile layout, …) can be exercised locally. Must be\n * JSON-serializable. Defaults to a single desktop \"app\" context; the simulator's Host tab can\n * override it at runtime (persisted per-browser, applied on restart).\n *\n * @internal\n */\n hostContext?: HostContext[]\n /**\n * Extra named `hostContext` presets for the simulator's Host tab, alongside the generic\n * built-ins — how a game ships its own scenarios (e.g. crossword's partner-embed toolbar\n * settings). Must be JSON-serializable.\n *\n * @internal\n */\n hostContextPresets?: HostContextPreset[]\n}\n\nconst simulatorURL = \"/@puzzmo-simulator-init.js\"\nconst virtualID = \"virtual:puzzmo-simulator\"\n\n/** @internal */\nexport type GameInfo = {\n /** Directory containing the puzzmo.json */\n dir: string\n slug: string\n displayName: string\n /** Vite-root-relative path to app bundle entry, if it exists */\n appBundlePath: string | null\n}\n\n/**\n * Discover all games from puzzmo.json files under a root directory.\n *\n * @internal\n */\nexport function discoverGames(viteRoot: string): Map<string, GameInfo> {\n const games = new Map<string, GameInfo>()\n const candidates = findPuzzmoJsonDirs(viteRoot, 3)\n if (fs.existsSync(path.join(viteRoot, \"puzzmo.json\"))) {\n candidates.unshift(viteRoot)\n }\n for (const dir of candidates) {\n try {\n const data = JSON.parse(fs.readFileSync(path.join(dir, \"puzzmo.json\"), \"utf-8\"))\n if (!data?.game?.slug) continue\n const bundleEntry = resolveBundleEntry(dir, \"src/appBundle\")\n let appBundle: string | null = null\n if (bundleEntry) {\n const relative = path.relative(viteRoot, bundleEntry)\n appBundle = \"/\" + relative.split(path.sep).join(\"/\")\n }\n games.set(data.game.slug, { dir, slug: data.game.slug, displayName: data.game.displayName, appBundlePath: appBundle })\n } catch {\n // skip invalid files\n }\n }\n return games\n}\n\n/**\n * Resolve which game a request belongs to using the referer URL.\n *\n * @internal\n */\nexport function resolveGameFromReferer(referer: string | undefined, games: Map<string, GameInfo>, viteRoot: string): GameInfo | undefined {\n if (referer) {\n try {\n const refPath = new URL(referer).pathname\n for (const g of games.values()) {\n const relDir = \"/\" + path.relative(viteRoot, g.dir).split(path.sep).join(\"/\")\n if (refPath.startsWith(relDir + \"/\") || refPath === relDir) return g\n }\n } catch {\n // ignore malformed referer\n }\n }\n if (games.size === 1) return games.values().next().value\n return undefined\n}\n\n/**\n * Generate the virtual module code for the simulator.\n *\n * @internal\n */\nexport function generateSimulatorCode(options: PuzzmoSimulatorPluginOptions, game: GameInfo | undefined): string {\n const { fixturesGlob: fixturesOpt, ...config } = options\n const fixturesGlob = fixturesOpt === false ? null : (fixturesOpt ?? \"/fixtures/puzzles/**/*.{json,toml}\")\n\n const lines = [`import { createSimulator } from \"@puzzmo/sdk/simulator\"`]\n\n // Load fixtures as raw strings so any text format reaches the game verbatim; the game does its own parsing.\n if (fixturesGlob) {\n lines.push(`const fixtures = import.meta.glob(${JSON.stringify(fixturesGlob)}, { query: \"?raw\", import: \"default\", eager: true })`)\n }\n\n if (game?.appBundlePath) {\n lines.push(`import(${JSON.stringify(game.appBundlePath)}).then(m => {`)\n lines.push(` if (m.renderThumbnail) globalThis.renderThumbnail = m.renderThumbnail`)\n lines.push(` if (m.getShareString) globalThis.getShareString = m.getShareString`)\n lines.push(`}).catch(() => {})`)\n }\n\n const simConfig = { ...config, ...(game?.slug ? { slug: game.slug } : {}) }\n const configEntries = Object.entries(simConfig).filter(([, v]) => v !== undefined)\n const configParts = configEntries.map(([k, v]) => `${k}: ${JSON.stringify(v)}`)\n if (fixturesGlob) configParts.push(\"fixtures\")\n\n lines.push(`createSimulator({ ${configParts.join(\", \")} })`)\n\n return lines.join(\"\\n\")\n}\n\n/** Vite plugin that injects the Puzzmo simulator in dev mode and handles OAuth callbacks. */\nexport function puzzmoSimulator(options: PuzzmoSimulatorPluginOptions = {}): Plugin {\n let games = new Map<string, GameInfo>()\n let viteRoot: string\n\n return {\n name: \"puzzmo-simulator\",\n apply: \"serve\",\n\n configResolved(config: ResolvedConfig) {\n viteRoot = config.root\n games = discoverGames(viteRoot)\n\n if (games.size === 0) {\n config.logger.info(`\\x1b[33m\\x1b[1m PUZZMO \\x1b[22m\\x1b[39m\\x1b[2m no puzzmo.json files found\\x1b[22m`)\n } else {\n const names = [...games.values()].map((g) => `\\x1b[36m${g.slug}\\x1b[39m`)\n const label = games.size === 1 ? \"game\" : \"games\"\n config.logger.info(`\\x1b[33m\\x1b[1m PUZZMO \\x1b[22m\\x1b[39m found ${games.size} ${label}: ${names.join(\"\\x1b[2m, \\x1b[22m\")}`)\n }\n },\n\n resolveId(id) {\n if (id === virtualID || id.startsWith(virtualID + \"?\")) return \"\\0\" + id\n },\n\n load(id) {\n if (!id.startsWith(\"\\0\" + virtualID)) return\n const params = new URLSearchParams(id.split(\"?\")[1] || \"\")\n const gameSlug = params.get(\"game\")\n const game = gameSlug ? games.get(gameSlug) : games.size === 1 ? games.values().next().value : undefined\n return generateSimulatorCode(options, game)\n },\n\n configureServer(server) {\n server.middlewares.use(\"/oauth/callback\", (_req, res) => {\n res.setHeader(\"Content-Type\", \"text/html\")\n res.end(`<!DOCTYPE html>\n<html><head><title>Puzzmo OAuth</title></head>\n<body><script>\nvar params = new URLSearchParams(window.location.search);\nvar returnUrl = sessionStorage.getItem(\"oauth_return_url\") || \"/\";\nvar url = new URL(returnUrl);\nparams.forEach(function(v, k) { url.searchParams.set(k, v); });\nwindow.location.href = url.toString();\n</script></body></html>`)\n })\n\n // Serve the simulator init module, resolving the game from the referer\n server.middlewares.use(async (req, res, next) => {\n if (req.url?.split(\"?\")[0] !== simulatorURL) return next()\n\n const game = resolveGameFromReferer(req.headers.referer, games, viteRoot)\n const moduleID = virtualID + (game ? `?game=${game.slug}` : \"\")\n const result = await server.transformRequest(moduleID)\n if (!result) return next()\n res.setHeader(\"Content-Type\", \"application/javascript\")\n res.end(result.code)\n })\n },\n\n transformIndexHtml() {\n return [\n {\n tag: \"script\",\n attrs: { type: \"module\", src: simulatorURL },\n injectTo: \"head\",\n },\n ]\n },\n }\n}\n\ntype BundlePluginOptions = {\n /** Entry file for the bundle */\n entry: string\n /** Output file name */\n outputFile: string\n}\n\nfunction createBundlePlugin(pluginName: string, defaults: BundlePluginOptions) {\n return (options: Partial<BundlePluginOptions> = {}): Plugin => {\n const { entry, outputFile } = { ...defaults, ...options }\n return {\n name: pluginName,\n apply: \"build\",\n async closeBundle() {\n // If the caller overrode `entry`, honor it as-is. Otherwise try `.js` first, then `.ts`.\n const resolvedEntry = options.entry\n ? path.isAbsolute(entry)\n ? entry\n : path.resolve(process.cwd(), entry)\n : (resolveBundleEntry(process.cwd(), stripBundleExt(entry)) ?? path.resolve(process.cwd(), entry))\n try {\n await build({\n configFile: false,\n logLevel: \"warn\",\n build: {\n lib: {\n entry: resolvedEntry,\n formats: [\"es\"],\n fileName: () => outputFile,\n },\n outDir: \"dist\",\n emptyOutDir: false,\n },\n })\n } catch (error) {\n console.error(`[${pluginName}] build failed:`, error)\n throw error\n }\n },\n }\n }\n}\n\n/** Strip the trailing extension from a default entry path so we can probe siblings. */\nconst stripBundleExt = (p: string) => p.replace(/\\.[jt]sx?$/i, \"\")\n\n/** Returns the absolute path to the first matching extension under `dir`, or null. */\nconst resolveBundleEntry = (dir: string, baseRelative: string): string | null => {\n for (const ext of [\".js\", \".ts\"]) {\n const candidate = path.join(dir, baseRelative + ext)\n if (fs.existsSync(candidate)) return candidate\n }\n return null\n}\n\nexport type AppBundlePluginOptions = {\n /** Entry file for the app bundle (default: `src/appBundle.js`) */\n entry?: string\n /** Output file name (default: `app-bundle.js`) */\n outputFile?: string\n}\n\n/**\n * Vite plugin that produces dist/app-bundle.js after the main build for app-level integrations.\n *\n * The bundle exports `renderThumbnail(puzzleStr, inputStr?, config?)` — a pure renderer\n * returning the SVG and its dimensions (`{ svg, width, height }`), used by the Puzzmo\n * platform for puzzle previews.\n */\nexport const appBundlePlugin = createBundlePlugin(\"app-bundle\", { entry: \"src/appBundle.js\", outputFile: \"app-bundle.js\" })\n\nexport type EditorBundlePluginOptions = {\n /** Entry file for the editor bundle (default: `src/editorBundle.js`) */\n entry?: string\n /** Output file name (default: `editor-bundle.js`) */\n outputFile?: string\n}\n\n/** Vite plugin that produces dist/editor-bundle.js after the main build for editor-level integrations. */\nexport const editorBundlePlugin = createBundlePlugin(\"editor-bundle\", { entry: \"src/editorBundle.js\", outputFile: \"editor-bundle.js\" })\n\n/**\n * Recursively find directories containing puzzmo.json, up to `maxDepth` levels deep.\n *\n * @internal\n */\nexport const findPuzzmoJsonDirs = (root: string, maxDepth: number, depth = 0): string[] => {\n if (depth >= maxDepth) return []\n const results: string[] = []\n let entries: fs.Dirent[]\n try {\n entries = fs.readdirSync(root, { withFileTypes: true })\n } catch {\n return results\n }\n for (const entry of entries) {\n if (!entry.isDirectory() || entry.name.startsWith(\".\") || entry.name === \"node_modules\") continue\n const dir = path.join(root, entry.name)\n if (fs.existsSync(path.join(dir, \"puzzmo.json\"))) {\n results.push(dir)\n }\n results.push(...findPuzzmoJsonDirs(dir, maxDepth, depth + 1))\n }\n return results\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;SA0GU,eAAA,EArEJ,IAAe,8BACf,IAAY;;;;;;AAiBlB,SAAgB,EAAc,GAAyC;CACrE,IAAM,oBAAQ,IAAI,KAAuB,EACnC,IAAa,EAAmB,GAAU,EAAE;AAClD,CAAI,EAAG,WAAW,EAAK,KAAK,GAAU,cAAc,CAAC,IACnD,EAAW,QAAQ,EAAS;AAE9B,MAAK,IAAM,KAAO,EAChB,KAAI;;EACF,IAAM,IAAO,KAAK,MAAM,EAAG,aAAa,EAAK,KAAK,GAAK,cAAc,EAAE,QAAQ,CAAC;AAChF,MAAI,EAAA,OAAA,SAAA,IAAC,EAAM,SAAA,SAAA,EAAM,MAAM;EACvB,IAAM,IAAc,EAAmB,GAAK,gBAAgB,EACxD,IAA2B;AAK/B,EAJI,MAEF,IAAY,MADK,EAAK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CAAC,OAAO,MAAM,EAAE;EAChC,IAAM,IAAY,EAAK,KAAK,GAAK,IAAe,EAAI;AACpD,MAAI,EAAG,WAAW,EAAU,CAAE,QAAO;;AAEvC,QAAO;;;;;;;;;AAiBT,MAAa,IAAkB,EAAmB,cAAc;CAAE,OAAO;CAAoB,YAAY;CAAiB,CAAC,EAU9G,IAAqB,EAAmB,iBAAiB;CAAE,OAAO;CAAuB,YAAY;CAAoB,CAAC,EAO1H,KAAsB,GAAc,GAAkB,IAAQ,MAAgB;AACzF,KAAI,KAAS,EAAU,QAAO,EAAE;CAChC,IAAM,IAAoB,EAAE,EACxB;AACJ,KAAI;AACF,MAAU,EAAG,YAAY,GAAM,EAAE,eAAe,IAAM,CAAC;aACjD;AACN,SAAO;;AAET,MAAK,IAAM,KAAS,GAAS;AAC3B,MAAI,CAAC,EAAM,aAAa,IAAI,EAAM,KAAK,WAAW,IAAI,IAAI,EAAM,SAAS,eAAgB;EACzF,IAAM,IAAM,EAAK,KAAK,GAAM,EAAM,KAAK;AAIvC,EAHI,EAAG,WAAW,EAAK,KAAK,GAAK,cAAc,CAAC,IAC9C,EAAQ,KAAK,EAAI,EAEnB,EAAQ,KAAK,GAAG,EAAmB,GAAK,GAAU,IAAQ,EAAE,CAAC;;AAE/D,QAAO"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@puzzmo/sdk",
3
- "version": "1.0.34",
3
+ "version": "1.0.36",
4
4
  "description": "Puzzmo runtime SDK for game developers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",