Skip to content

Ikagaka 1.0 API Specifications

Legokichi Duckscallion edited this page Feb 1, 2015 · 19 revisions

Ikagaka 1.0 API Specifications

Webブラウザで動く伺か互換環境"如何か"はIkagaka1.0仕様に基づいたコンポーネントを組み合わせて開発されています。

このコンポーネントを再利用することで、例えば"如何か"と同じ描画エンジンを利用したシェルエディタや、ベースウェアと連帯した栞エディタなどの開発が容易になります。

また、このコンポーネント仕様と互換のコンポーネントに切り替えることで、従来のシェル描画エンジンからMMDやSVGを利用したシェル描画エンジンの利用も想定しています。

Ikagaka Compornents

  • NamedManager API - ゴーストの見た目のウインドウマネージャのIFを定義します
    • Named API - スコープ切り替えのIFを定義します
      • Shell API - Webブラウザ環境で動作するシェル描画エンジンが満たすべきIFを定義します
      • Balloon API - Webブラウザ環境で動作するバルーン描画エンジンが満たすべきIFを定義します
  • NanikaManager API - 未定義
    • Nanika API - 未定義
      • SakuraScript API - Named APIを利用したSakuraScript再生エンジンが満たすべきIFを定義します
      • Ghost API - Webブラウザ環境で動作するSakuraScript生成エンジン(栞)が満たすべきIFを定義します
  • Storage API - Shell/Balloon/Ghost APIに渡されるFileSystemのラッパIFを定義します

Ikagaka NamedManager API

see also: https://github.com/Ikagaka/Named.js/wiki/Ikagaka-Named-API

Ikagaka Named API

see also: https://github.com/Ikagaka/Named.js/wiki/Ikagaka-Named-API

Ikagaka Shell API

see also: https://github.com/Ikagaka/Named.js/wiki/Ikagaka-Named-API

Ikagaka Balloon API

see also: https://github.com/Ikagaka/Named.js/wiki/Ikagaka-Named-API

Ikagaka NanikaManager API

see also: https://github.com/Ikagaka/Nanika

Ikagaka Nanika API

see also: https://github.com/Ikagaka/Nanika

Ikagaka SakuraScript API

see also: https://github.com/Ikagaka/SakuraScriptPlayer.js/wiki/

Ikagaka Ghost API

see also: https://github.com/Ikagaka/Ghost.js/wiki/Ikagaka-Ghost-API

Ikagaka Storage API

see also: https://github.com/Ikagaka/NanikaStorage

see also: https://github.com/Ikagaka/NarLoader

see also: https://github.com/Ikagaka/Ghost.js/issues/13

interface NanikaStorageIF {
  ghost( dirpath: string ): Promise<NanikaDirectoryIF>;
  ghost( dirpath: string, directory: NanikaDirectoryIF, merge?: boolean ): Promise<NanikaDirectoryIF>;
  // storage.ghost('akos').then(function(dir){...});
  // storage.ghost('akos', dir).then(function(dir){...});
  // dirpathで指定されたゴーストディレクトリbaseware/ghost/dirpath/を読み出し、書き込みします。
  // 引数directoryはNanikaDirectoryです。
  // 引数directoryが指定されれば内容をファイルシステムに書き込みます。 mergeがtrueなら上書き、そうでないなら以前の内容を削除してから書き込みます。
  // 返り値はファイルシステムから読み出したNanikaDirectoryを解決値とするPromiseです。

  ghost_master( dirpath: string ): Promise<NanikaDirectoryIF>;
  ghost_master( dirpath: string, directory: NanikaDirectoryIF, merge?: boolean ): Promise<NanikaDirectoryIF>;
  // storage.ghost_master('akos').then((dir)=>{...});
  // storage.ghost_master('akos', dir).then((dir)=>{...});

  balloon( dirpath: string): Promise<NanikaDirectoryIF>;
  balloon( dirpath: string, directory: NanikaDirectoryIF, merge?: boolean ): Promise<NanikaDirectoryIF>;
  // storage.balloon('origin').then((dir)=>{...});
  // storage.balloon('origin', dir).then((dir)=>{...});

  shell( dirpath: string, shellpath: string ): Promise<NanikaDirectoryIF>;
  shell( dirpath: string, shellpath: string, directory: NanikaDirectoryIF, merge?: boolean ): Promise<NanikaDirectoryIF>;
  // storage.shell('akos', 'master').then((dir)=>{...});
  // storage.shell('akos', 'master', dir).then((dir)=>{...});

  base_profile(): Promise<BaseProfileIF>;
  base_profile( profile: BaseProfileIF ): Promise<BaseProfileIF>;
  // base_profile().then((profile)=>{...});
  ghost_profile( dirpath: string): Promise<GhostProfileIF>;
  ghost_profile( dirpath: string, profile: GhostProfileIF ): Promise<GhostProfileIF>;
  // ns.ghost_profile("origin").then((profile)=>{...});
  balloon_profile( dirpath: string): Promise<BalloonProfileIF>;
  balloon_profile( dirpath: string, profile: BalloonProfileIF ): Promise<BalloonProfileIF>;
  // ns.balloon_profile("origin").then((profile)=>{...});
  shell_profile( dirpath: string ): Promise<ShellProfileIF>;
  shell_profile( dirpath: string, shellpath: string, profile: ShellProfileIF ): Promise<ShellProfileIF>;
  // ns.shell_profile("ako", "master").then((profile)=>{...});
  // プロファイルの読み出し、書き込みをします。
}

interface BaseProfileIF {}
interface GhostProfileIF {}
interface BalloonProfileIF {}
interface ShellProfileIF {}
// プロファイルのJSONのスキーマ。

interface NanikaDirectoryIF {
  asArrayBuffer(): Promise<{ [filepath]: ArrayBuffer; }>;
  // 子孫パスファイル/ディレクトリを一括でArrayBufferで読み込む
  // filepathキーはカレントディレクトリからの子孫パス。

  listChildren(): Promise<string[]>;
  // 子ファイル/ディレクトリ一覧

  addDirectory( dir: { [filepath]: ArrayBuffer; } ): NanikaDirectoryIF;
  // nd.addDirectory({ "profile/setting.json": file.buffer}).then((dir)=>{...});
  // dir: カレントディレクトリにマージするファイルのハッシュ。キーはカレントディレクトリからの子孫パス

  getDirectory( dirpath: string ): NanikaDirectoryIF;
  // nd.getDirectory('ghost/master').then((dir)=>{...});
  // dirpath: カレントディレクトリからの子孫ファイル/ディレクトリパス

  getElements( elempaths: string[] ): Promise<NanikaDirectoryIF>;
  // nd.getElements(['ghost', 'shell']).then((dir)=>{...});
  // elempaths: カレントディレクトリからの子孫ファイル/ディレクトリパスの配列

  removeElements( elempaths: string[] ): Promise<NanikaDirectoryIF>;
  // nd.removeElements(['myballoon']).then((dir)=>{...});
  // elempaths: カレントディレクトリからの子孫ファイル/ディレクトリパスの配列
  // 返り値: 削除後のカレントディレクトリ

  hasElement( elempath: string ): Promise<boolean>;
  // nd.hasElement('shell/hoge').then((exists)=>{...});
  // elempath: カレントディレクトリからの子孫ファイル/ディレクトリパス
}

interface NanikaFileIF {
  read(): Promise<ArrayBuffer>;
  toString(): Promise<string>;
}