code-playpad 0.18.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/element.d.ts CHANGED
@@ -33,6 +33,14 @@ export interface RenderEventDetail {
33
33
  rootText: string;
34
34
  language: string;
35
35
  }
36
+ /** A file the reader or the page added, renamed or removed. */
37
+ export interface FilesChangeEventDetail {
38
+ action: 'add' | 'rename' | 'remove';
39
+ name: string;
40
+ /** Rename only: what the file was called. */
41
+ previousName?: string;
42
+ files: Files;
43
+ }
36
44
  /**
37
45
  * `class X extends HTMLElement` is evaluated when the module loads, so importing
38
46
  * this package during server rendering (Next.js, Astro, SvelteKit) would throw
@@ -62,6 +70,12 @@ export declare class CodePlayPadElement extends ElementBase {
62
70
  set entry(value: string);
63
71
  /** Bring a file on screen. */
64
72
  openFile(name: string): void;
73
+ /** Adds a file and opens it. Throws if a rule refuses the name. */
74
+ addFile(name: string, contents?: string): void;
75
+ /** Renames a file, keeping its contents. Throws if a rule refuses it. */
76
+ renameFile(from: string, to: string): void;
77
+ /** Removes a file. If it's open, a neighbouring file opens. Throws if a rule refuses it. */
78
+ removeFile(name: string): void;
65
79
  get stdin(): string;
66
80
  set stdin(value: string);
67
81
  /** Which runtime executes the code: "python", "javascript" or "typescript".
package/dist/element.js CHANGED
@@ -1 +1 @@
1
- export{t as CodePlayPadElement,n as defineCodePlayPad}from"./element-DnazizZC.js";
1
+ export{t as CodePlayPadElement,n as defineCodePlayPad}from"./element-Ce06T38j.js";
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { CodePlayPadElement, defineCodePlayPad } from './element.js';
2
- export type { ConsoleEventDetail, ErrorEventDetail, OutputEventDetail, RenderEventDetail, RunEventDetail } from './element.js';
2
+ export type { ConsoleEventDetail, ErrorEventDetail, FilesChangeEventDetail, OutputEventDetail, RenderEventDetail, RunEventDetail } from './element.js';
3
3
  export { EDITOR_THEMES, getThemePreference, onThemePreferenceChange, setThemePreference } from './theme.js';
4
4
  export type { EditorTheme, EditorThemeColors, ThemeMode, ThemePreference } from './theme.js';
5
5
  export { createEditor } from './editor.js';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{_ as e,a as t,c as n,d as r,f as i,g as a,h as o,i as s,m as c,n as l,o as u,p as d,r as f,s as p,t as m,u as h,v as g,y as _}from"./element-DnazizZC.js";import{t as v}from"./react-version.generated-BNNJmf7J.js";import{a as y,f as b,i as x,n as S,o as C,r as w,t as T}from"./config-3Z6xX6Jr.js";export{m as CodePlayPadElement,a as EDITOR_THEMES,T as PYODIDE_VERSION,v as REACT_VERSION,h as RunStopped,r as WorkerUnavailable,f as allProgress,s as clearSnippet,S as configureCSharp,w as configureCpp,x as configurePython,y as configureReact,C as configureTypeScript,o as createEditor,l as defineCodePlayPad,t as getProgress,i as getRuntime,e as getThemePreference,d as listRuntimes,u as loadSnippet,g as onThemePreferenceChange,b as pyodideAssetUrls,c as registerRuntime,p as saveSnippet,n as setProgress,_ as setThemePreference};
1
+ import{_ as e,a as t,c as n,d as r,f as i,g as a,h as o,i as s,m as c,n as l,o as u,p as d,r as f,s as p,t as m,u as h,v as g,y as _}from"./element-Ce06T38j.js";import{t as v}from"./react-version.generated-BNNJmf7J.js";import{a as y,f as b,i as x,n as S,o as C,r as w,t as T}from"./config-3Z6xX6Jr.js";export{m as CodePlayPadElement,a as EDITOR_THEMES,T as PYODIDE_VERSION,v as REACT_VERSION,h as RunStopped,r as WorkerUnavailable,f as allProgress,s as clearSnippet,S as configureCSharp,w as configureCpp,x as configurePython,y as configureReact,C as configureTypeScript,o as createEditor,l as defineCodePlayPad,t as getProgress,i as getRuntime,e as getThemePreference,d as listRuntimes,u as loadSnippet,g as onThemePreferenceChange,b as pyodideAssetUrls,c as registerRuntime,p as saveSnippet,n as setProgress,_ as setThemePreference};