|
|
|
|
@ -41,7 +41,7 @@ export const _rt = {
|
|
|
|
|
clip: (config: any) => ({ kind: 'clip', ...config }),
|
|
|
|
|
opacity: (config: any) => ({ kind: 'opacity', ...config }),
|
|
|
|
|
stateful: (config: any) => ({ kind: 'stateful', ...config }),
|
|
|
|
|
measure: (config: any) => ({ kind: 'measure', ...config }),
|
|
|
|
|
measure: measure,
|
|
|
|
|
measureText: (text: string) => {
|
|
|
|
|
const canvas = document.createElement('canvas');
|
|
|
|
|
const ctx = canvas.getContext('2d');
|
|
|
|
|
@ -53,8 +53,6 @@ export const _rt = {
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
measure: measure,
|
|
|
|
|
|
|
|
|
|
batch: (events: any[]) => ({ _tag: 'Batch', _0: events }),
|
|
|
|
|
noOp: { _tag: 'NoOp' },
|
|
|
|
|
focus: (key: string) => ({ _tag: 'Focus', _0: key }),
|
|
|
|
|
@ -95,6 +93,7 @@ export const _rt = {
|
|
|
|
|
hasField: (field: string) => (obj: any) => ({
|
|
|
|
|
_tag: (typeof obj === 'object' && obj !== null && field in obj) ? 'True' : 'False'
|
|
|
|
|
}),
|
|
|
|
|
isFunction: (v: any) => ({ _tag: typeof v === 'function' ? 'True' : 'False' }),
|
|
|
|
|
storeSearch: (query: string) => {
|
|
|
|
|
return Object.keys(store)
|
|
|
|
|
.filter(name => _rt.fuzzyMatch(query)(name)._tag === 'True')
|
|
|
|
|
|