# UnifiedSlide Architecture Reorganization

UnifiedSlide is being reorganized to comply with the iToolkits v1.6 Control Framework and the single-file tool application policy.

## Current alpha15 scope

alpha15 is a foundation release. It intentionally preserves the visually stable alpha13/alpha14 workspace while adding the missing architecture shell.

Added runtime layers:

- `scripts/controls/unified_slide_control.js`
- `scripts/commands/command_registry.js`
- `scripts/models/state_store.js`
- `scripts/models/event_bus.js`
- `scripts/registries/format_registry.js`
- `scripts/services/io/file_io_service.js`
- `scripts/services/security/security_policy_service.js`
- `scripts/views/main_view.js`

## Migration rule

The old workspace implementation remains in `scripts/app.js` for layout stability. New work should not add large logic directly to `app.js`. New behavior should be added as one of:

- Command
- StateStore branch
- Service
- Adapter
- Registry
- View / Controller

Then the legacy UI should call the command instead of duplicating logic.

## Host-facing API

```javascript
require(['UnifiedSlide/main'], function (UnifiedSlide) {
  var control = UnifiedSlide.createControl({
    container: '#target',
    language: 'ja',
    OpenFile: hostOpenFile,
    SaveFile: hostSaveFile
  });

  control.exec('open');
  control.on('afterCommand', function (event) {
    console.log(event.commandId, event.result);
  });
});
```

## File I/O direction

The runtime package must not hard-code Local Disk, App Storage or Google Drive UI as product logic. Those storage differences are handled by Host callbacks or Demo-only local callback implementations.

## Next migration steps

1. Move existing menu and toolbar handlers to CommandRegistry.
2. Move document/file context into StateStore.
3. Move USLDX read/write into a PackageService.
4. Move PPTX Import/Export to OOXML services.
5. Move canvas/editor interactions behind View / Controller methods.


## UnifiedControl dependency

Host/Demo configures `UnifiedControl` as a RequireJS alias to the shared Control Framework package. UnifiedSlide does not copy UnifiedControl into this ZIP.

```js
require.config({
  paths: {
    UnifiedControl: 'https://cdn.skylarkjs.com/itoolkits/developments/UnifiedControl/scripts',
    UnifiedSlide: '<UnifiedSlidePackageRoot>/scripts'
  }
});
```
