How to use the @ephox/boulder.FieldSchema.strict function in @ephox/boulder

To help you get started, we’ve selected a few @ephox/boulder examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tinymce / tinymce / modules / tinymce / src / themes / mobile / main / ts / ui / SerialisedDialog.ts View on Github external
const sketch = function (rawSpec) {
  const navigateEvent = 'navigateEvent';

  const wrapperAdhocEvents = 'serializer-wrapper-events';
  const formAdhocEvents = 'form-events';

  const schema = ValueSchema.objOf([
    FieldSchema.strict('fields'),
    // Used for when datafields are present.
    FieldSchema.defaulted('maxFieldIndex', rawSpec.fields.length - 1),
    FieldSchema.strict('onExecute'),
    FieldSchema.strict('getInitialValue'),
    FieldSchema.state('state', function () {
      return {
        dialogSwipeState: Singleton.value(),
        currentScreen: Cell(0)
      };
    })
  ]);

  const spec = ValueSchema.asRawOrDie('SerialisedDialog', schema, rawSpec);

  const navigationButton = function (direction, directionName, enabled) {
    return Button.sketch({
      dom: UiDomFactory.dom('<span class="${prefix}-icon-' + directionName + ' ${prefix}-icon"></span>'),
      action (button) {
        AlloyTriggers.emitWith(button, navigateEvent, { direction });
      },
github tinymce / tinymce / modules / tinymce / src / themes / silver / main / ts / ui / general / OuterContainer.ts View on Github external
initGroups: [],
        getSink: spec.getSink,
        backstage: spec.backstage,
        moreDrawerData: {
          lazyToolbar: spec.lazyToolbar,
          lazyMoreButton: spec.lazyMoreButton,
          lazyHeader: spec.lazyHeader
        }
      };
      return renderer(toolbarSpec);
    }
  },
  name: 'toolbar',
  schema: [
    FieldSchema.strict('dom'),
    FieldSchema.strict('onEscape'),
    FieldSchema.strict('getSink')
  ]
});

const partHeader = Composite.partType.optional({
  factory: {
    sketch: renderHeader
  },
  name: 'header',
  schema: [
    FieldSchema.strict('dom')
  ]
});

const partSocket = Composite.partType.optional({
  // factory: Fun.identity,
github tinymce / tinymce / modules / alloy / src / main / ts / ephox / alloy / api / behaviour / Behaviour.ts View on Github external
return CommonBehaviour.create(value.fields, value.name, value.active, value.apis, value.extra, value.state);
};

export interface BehaviourModeSpec {
  branchKey: string;
  branches: Record;
  name: string;
  active?: any;
  apis?: { };
  extra?: { };
  state?: { };
}

const modeSchema: Processor = ValueSchema.objOfOnly([
  FieldSchema.strict('branchKey'),
  FieldSchema.strict('branches'),
  FieldSchema.strict('name'),
  FieldSchema.defaulted('active', { }),
  FieldSchema.defaulted('apis', { }),
  FieldSchema.defaulted('state', NoState),
  FieldSchema.defaulted('extra', { })
]);

const createModes = (data: BehaviourModeSpec): AlloyBehaviour =&gt; {
  const value: BehaviourModeSpec = ValueSchema.asRawOrDie('Creating behaviour: ' + data.name, modeSchema, data);
  return CommonBehaviour.createModes(
    ValueSchema.choose(value.branchKey, value.branches),
    value.name, value.active, value.apis, value.extra, value.state
  );
};

const revoke = Fun.constant(undefined);
github tinymce / tinymce / modules / tinymce / src / themes / silver / main / ts / ui / general / Notification.ts View on Github external
detail.onAction(comp);
        }
      })
    ),
    apis
  };
};

export const Notification = Sketcher.single({
  name: 'Notification',
  factory,
  configFields: [
    FieldSchema.option('level'),
    FieldSchema.strict('progress'),
    FieldSchema.strict('icon'),
    FieldSchema.strict('onAction'),
    FieldSchema.strict('text'),
    FieldSchema.strict('iconProvider'),
    FieldSchema.strict('translationProvider'),
  ],
  apis: {
    updateProgress: (apis: NotificationSketchApis, comp: AlloyComponent, percent: number) =&gt; {
      apis.updateProgress(comp, percent);
    },
    updateText: (apis: NotificationSketchApis, comp: AlloyComponent, text: string) =&gt; {
      apis.updateText(comp, text);
    }
  }
}) as NotificationSketcher;
github tinymce / tinymce / src / main / ts / ephox / alloy / ui / schema / SplitFloatingToolbarSchema.ts View on Github external
import * as Behaviour from '../../api/behaviour/Behaviour';
import { Focusing } from '../../api/behaviour/Focusing';
import { Keying } from '../../api/behaviour/Keying';
import { Toggling } from '../../api/behaviour/Toggling';
import { Toolbar } from '../../api/ui/Toolbar';
import * as SplitToolbarBase from '../common/SplitToolbarBase';
import * as Fields from '../../data/Fields';
import * as PartType from '../../parts/PartType';
import { SplitFloatingToolbarDetail } from '../types/SplitFloatingToolbarTypes';
import * as AlloyParts from '../../parts/AlloyParts';
import * as ToolbarSchema from './ToolbarSchema';

const schema: () => FieldProcessorAdt[] = Fun.constant([
  Fields.markers([ 'overflowToggledClass' ]),
  FieldSchema.strict('getAnchor'),
  FieldSchema.strict('lazySink')
].concat(
  SplitToolbarBase.schema()
));

const parts: () => PartType.PartTypeAdt[] = Fun.constant([
  PartType.required({
    factory: Toolbar,
    schema: ToolbarSchema.schema(),
    name: 'primary'
  }),

  PartType.external({
    factory: Toolbar,
    schema: ToolbarSchema.schema(),
    name: 'overflow',
    overrides (detail: SplitFloatingToolbarDetail) {
github tinymce / tinymce / modules / alloy / src / main / ts / ephox / alloy / api / behaviour / Behaviour.ts View on Github external
};

export interface BehaviourModeSpec {
  branchKey: string;
  branches: Record;
  name: string;
  active?: any;
  apis?: { };
  extra?: { };
  state?: { };
}

const modeSchema: Processor = ValueSchema.objOfOnly([
  FieldSchema.strict('branchKey'),
  FieldSchema.strict('branches'),
  FieldSchema.strict('name'),
  FieldSchema.defaulted('active', { }),
  FieldSchema.defaulted('apis', { }),
  FieldSchema.defaulted('state', NoState),
  FieldSchema.defaulted('extra', { })
]);

const createModes = (data: BehaviourModeSpec): AlloyBehaviour =&gt; {
  const value: BehaviourModeSpec = ValueSchema.asRawOrDie('Creating behaviour: ' + data.name, modeSchema, data);
  return CommonBehaviour.createModes(
    ValueSchema.choose(value.branchKey, value.branches),
    value.name, value.active, value.apis, value.extra, value.state
  );
};

const revoke = Fun.constant(undefined);
const noActive = Fun.constant({ });
github tinymce / tinymce / modules / tinymce / src / themes / silver / main / ts / ui / general / Notification.ts View on Github external
action: (comp) =&gt; {
          detail.onAction(comp);
        }
      })
    ),
    apis
  };
};

export const Notification = Sketcher.single({
  name: 'Notification',
  factory,
  configFields: [
    FieldSchema.option('level'),
    FieldSchema.strict('progress'),
    FieldSchema.strict('icon'),
    FieldSchema.strict('onAction'),
    FieldSchema.strict('text'),
    FieldSchema.strict('iconProvider'),
    FieldSchema.strict('translationProvider'),
  ],
  apis: {
    updateProgress: (apis: NotificationSketchApis, comp: AlloyComponent, percent: number) =&gt; {
      apis.updateProgress(comp, percent);
    },
    updateText: (apis: NotificationSketchApis, comp: AlloyComponent, text: string) =&gt; {
      apis.updateText(comp, text);
    }
  }
}) as NotificationSketcher;
github tinymce / tinymce / modules / tinymce / src / themes / silver / main / ts / ui / general / Notification.ts View on Github external
}],
        action: (comp) =&gt; {
          detail.onAction(comp);
        }
      })
    ),
    apis
  };
};

export const Notification = Sketcher.single({
  name: 'Notification',
  factory,
  configFields: [
    FieldSchema.option('level'),
    FieldSchema.strict('progress'),
    FieldSchema.strict('icon'),
    FieldSchema.strict('onAction'),
    FieldSchema.strict('text'),
    FieldSchema.strict('iconProvider'),
    FieldSchema.strict('translationProvider'),
  ],
  apis: {
    updateProgress: (apis: NotificationSketchApis, comp: AlloyComponent, percent: number) =&gt; {
      apis.updateProgress(comp, percent);
    },
    updateText: (apis: NotificationSketchApis, comp: AlloyComponent, text: string) =&gt; {
      apis.updateText(comp, text);
    }
  }
}) as NotificationSketcher;
github tinymce / tinymce / modules / alloy / src / main / ts / ephox / alloy / api / behaviour / Behaviour.ts View on Github external
const value = ValueSchema.asRawOrDie('Creating behaviour: ' + data.name, simpleSchema, data);
  return CommonBehaviour.create(value.fields, value.name, value.active, value.apis, value.extra, value.state);
};

export interface BehaviourModeSpec {
  branchKey: string;
  branches: Record;
  name: string;
  active?: any;
  apis?: { };
  extra?: { };
  state?: { };
}

const modeSchema: Processor = ValueSchema.objOfOnly([
  FieldSchema.strict('branchKey'),
  FieldSchema.strict('branches'),
  FieldSchema.strict('name'),
  FieldSchema.defaulted('active', { }),
  FieldSchema.defaulted('apis', { }),
  FieldSchema.defaulted('state', NoState),
  FieldSchema.defaulted('extra', { })
]);

const createModes = (data: BehaviourModeSpec): AlloyBehaviour =&gt; {
  const value: BehaviourModeSpec = ValueSchema.asRawOrDie('Creating behaviour: ' + data.name, modeSchema, data);
  return CommonBehaviour.createModes(
    ValueSchema.choose(value.branchKey, value.branches),
    value.name, value.active, value.apis, value.extra, value.state
  );
};
github tinymce / tinymce / modules / tinymce / src / themes / silver / main / ts / ui / general / Notification.ts View on Github external
})
    ),
    apis
  };
};

export const Notification = Sketcher.single({
  name: 'Notification',
  factory,
  configFields: [
    FieldSchema.option('level'),
    FieldSchema.strict('progress'),
    FieldSchema.strict('icon'),
    FieldSchema.strict('onAction'),
    FieldSchema.strict('text'),
    FieldSchema.strict('iconProvider'),
    FieldSchema.strict('translationProvider'),
  ],
  apis: {
    updateProgress: (apis: NotificationSketchApis, comp: AlloyComponent, percent: number) =&gt; {
      apis.updateProgress(comp, percent);
    },
    updateText: (apis: NotificationSketchApis, comp: AlloyComponent, text: string) =&gt; {
      apis.updateText(comp, text);
    }
  }
}) as NotificationSketcher;