@kwiz/fluentui 1.0.175 → 1.0.178

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.
@@ -6,6 +6,14 @@ export interface iCodeEditorProps {
6
6
  /** key: name of library/module, value: types, enums, interfaces and declare global variables */
7
7
  extraLibs?: IDictionary<string>;
8
8
  hideLineNumbers?: boolean;
9
+ jsonSchemaValidations?: {
10
+ /** https://your-app/license-blob-schema.json */
11
+ uri: string;
12
+ /** ["*"], // Apply to all JSON models or use a specific model URI */
13
+ fileMatch: string[];
14
+ /** json schema */
15
+ schema: Object;
16
+ }[];
9
17
  }
10
18
  /** it is recommended to lazy load this control into its own chunk */
11
19
  export declare function CodeEditor(props: iCodeEditorProps): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { isNotEmptyArray } from "@kwiz/common";
2
3
  import Editor from '@monaco-editor/react';
3
4
  /** it is recommended to lazy load this control into its own chunk */
4
5
  export function CodeEditor(props) {
@@ -9,6 +10,11 @@ export function CodeEditor(props) {
9
10
  // extra libraries
10
11
  if (props.extraLibs)
11
12
  Object.keys(props.extraLibs).forEach(key => monaco.languages.typescript.javascriptDefaults.addExtraLib(props.extraLibs[key], key));
13
+ if (isNotEmptyArray(props.jsonSchemaValidations))
14
+ monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
15
+ validate: true,
16
+ schemas: props.jsonSchemaValidations
17
+ });
12
18
  }, onChange: (value, ev) => {
13
19
  props.onChange(value);
14
20
  } })] });
@@ -1 +1 @@
1
- {"version":3,"file":"editor.js","sourceRoot":"","sources":["../../../src/controls/code-editor/editor.tsx"],"names":[],"mappings":";AAEA,OAAO,MAAM,MAAM,sBAAsB,CAAC;AAW1C,qEAAqE;AACrE,MAAM,UAAU,UAAU,CAAC,KAAuB;IAC9C,OAAO,8BACP,0BAAQ,4BAA4B,GAAS,EA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S;iBACzD,EACD,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,WAAW,EAAE,MAAM,CAAC,EAAE;oBAClB,kBAAkB;oBAClB,IAAI,KAAK,CAAC,SAAS;wBACf,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CACvC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,kBAAkB,CAAC,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CACxF,CAAC;oBAEN,IAAI,eAAe,CAAC,KAAK,CAAC,qBAAqB,CAAC;wBAC5C,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,qBAAqB,CAAC;4BACrD,QAAQ,EAAE,IAAI;4BACd,OAAO,EAAE,KAAK,CAAC,qBAAqB;yBACvC,CAAC,CAAC;gBACX,CAAC,EACD,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE;oBACpB,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;gBAC1B,CAAC,GACH,IAAG,CAAC;AACd,CAAC"}
@@ -4,10 +4,11 @@ export * from './drag-drop';
4
4
  export * from './hooks';
5
5
  export * from './hooks-events';
6
6
  export * from './use-alerts';
7
- export * from './use-track-changes';
7
+ export * from './use-controlled-state-tracker';
8
8
  export * from './use-highlight';
9
+ export * from './use-is-concurrenct';
9
10
  export * from './use-reload-tracker';
10
11
  export * from './use-show-on-hover';
11
12
  export * from './use-theme';
12
13
  export * from './use-toast';
13
- export * from './use-controlled-state-tracker';
14
+ export * from './use-track-changes';
@@ -4,11 +4,12 @@ export * from './drag-drop';
4
4
  export * from './hooks';
5
5
  export * from './hooks-events';
6
6
  export * from './use-alerts';
7
- export * from './use-track-changes';
7
+ export * from './use-controlled-state-tracker';
8
8
  export * from './use-highlight';
9
+ export * from './use-is-concurrenct';
9
10
  export * from './use-reload-tracker';
10
11
  export * from './use-show-on-hover';
11
12
  export * from './use-theme';
12
13
  export * from './use-toast';
13
- export * from './use-controlled-state-tracker';
14
+ export * from './use-track-changes';
14
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,gCAAgC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Call at the beginning of a useEffect, check after all your promises finished before applying results to state.
3
+ * You must keep the same name for each useEffect
4
+ * const {getConcurrency} = useIsConcurrent();
5
+ * useEffect(()=>{
6
+ * const c = getConcurrency('loading data');
7
+ * const result = await someSlowPromise();
8
+ * if( c.isCurrent() ) setData(result);
9
+ * },[]);
10
+ */
11
+ export declare function useIsConcurrent(): {
12
+ isCurrent: (effectName: string, value: number) => boolean;
13
+ /** effectName must be unique for each useEffect */
14
+ getConcurrency: (effectName: string) => {
15
+ value: number;
16
+ isCurrent: () => boolean;
17
+ };
18
+ };
@@ -0,0 +1,37 @@
1
+ import { CommonLogger } from "@kwiz/common";
2
+ import { useCallback, useRef } from "react";
3
+ const logger = new CommonLogger("useIsConcurrent");
4
+ /**
5
+ * Call at the beginning of a useEffect, check after all your promises finished before applying results to state.
6
+ * You must keep the same name for each useEffect
7
+ * const {getConcurrency} = useIsConcurrent();
8
+ * useEffect(()=>{
9
+ * const c = getConcurrency('loading data');
10
+ * const result = await someSlowPromise();
11
+ * if( c.isCurrent() ) setData(result);
12
+ * },[]);
13
+ */
14
+ export function useIsConcurrent() {
15
+ const keys = useRef({});
16
+ const isCurrent = useCallback((effectName, value) => {
17
+ const isConcurrent = keys.current[effectName] === value;
18
+ if (!isConcurrent)
19
+ logger.log(`${effectName}:${value} is not concurrent`);
20
+ return isConcurrent;
21
+ }, []);
22
+ return {
23
+ isCurrent,
24
+ /** effectName must be unique for each useEffect */
25
+ getConcurrency: (effectName) => {
26
+ const myValue = (keys.current[effectName] > 0 ? keys.current[effectName] : 0) + 1;
27
+ //update ref
28
+ keys.current[effectName] = myValue;
29
+ logger.log(`${effectName}:${myValue} started`);
30
+ return {
31
+ value: myValue,
32
+ isCurrent: () => isCurrent(effectName, myValue)
33
+ };
34
+ }
35
+ };
36
+ }
37
+ //# sourceMappingURL=use-is-concurrenct.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-is-concurrenct.js","sourceRoot":"","sources":["../../src/helpers/use-is-concurrenct.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE5C,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,iBAAiB,CAAC,CAAC;AAEnD;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe;IAC3B,MAAM,IAAI,GAAG,MAAM,CAAsB,EAAE,CAAC,CAAC;IAE7C,MAAM,SAAS,GAAG,WAAW,CAAC,CAAC,UAAkB,EAAE,KAAa,EAAE,EAAE;QAChE,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,KAAK,CAAC;QACxD,IAAI,CAAC,YAAY;YAAE,MAAM,CAAC,GAAG,CAAC,GAAG,UAAU,IAAI,KAAK,oBAAoB,CAAC,CAAC;QAC1E,OAAO,YAAY,CAAC;IACxB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACH,SAAS;QACT,mDAAmD;QACnD,cAAc,EAAE,CAAC,UAAkB,EAAE,EAAE;YACnC,MAAM,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YAClF,YAAY;YACZ,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC;YAEnC,MAAM,CAAC,GAAG,CAAC,GAAG,UAAU,IAAI,OAAO,UAAU,CAAC,CAAC;YAC/C,OAAO;gBACH,KAAK,EAAE,OAAO;gBACd,SAAS,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,OAAO,CAAC;aAClD,CAAC;QACN,CAAC;KACJ,CAAC;AACN,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kwiz/fluentui",
3
- "version": "1.0.175",
3
+ "version": "1.0.178",
4
4
  "description": "KWIZ common controls for FluentUI",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",