@symbo.ls/create 2.11.353 → 2.11.354

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.
@@ -209,7 +209,7 @@ var require_types = __commonJS({
209
209
  __export12(types_exports, {
210
210
  TYPES: () => TYPES,
211
211
  is: () => is,
212
- isArray: () => isArray6,
212
+ isArray: () => isArray7,
213
213
  isBoolean: () => isBoolean,
214
214
  isDate: () => isDate,
215
215
  isDefined: () => isDefined3,
@@ -219,7 +219,7 @@ var require_types = __commonJS({
219
219
  isNumber: () => isNumber2,
220
220
  isObject: () => isObject12,
221
221
  isObjectLike: () => isObjectLike3,
222
- isString: () => isString13,
222
+ isString: () => isString14,
223
223
  isUndefined: () => isUndefined9
224
224
  });
225
225
  module2.exports = __toCommonJS12(types_exports);
@@ -229,12 +229,12 @@ var require_types = __commonJS({
229
229
  return false;
230
230
  return typeof arg === "object" && arg.constructor === Object;
231
231
  };
232
- var isString13 = (arg) => typeof arg === "string";
232
+ var isString14 = (arg) => typeof arg === "string";
233
233
  var isNumber2 = (arg) => typeof arg === "number";
234
234
  var isFunction4 = (arg) => typeof arg === "function";
235
235
  var isBoolean = (arg) => arg === true || arg === false;
236
236
  var isNull = (arg) => arg === null;
237
- var isArray6 = (arg) => Array.isArray(arg);
237
+ var isArray7 = (arg) => Array.isArray(arg);
238
238
  var isDate = (d) => d instanceof Date;
239
239
  var isObjectLike3 = (arg) => {
240
240
  if (arg === null)
@@ -242,16 +242,16 @@ var require_types = __commonJS({
242
242
  return typeof arg === "object";
243
243
  };
244
244
  var isDefined3 = (arg) => {
245
- return isObject12(arg) || isObjectLike3(arg) || isString13(arg) || isNumber2(arg) || isFunction4(arg) || isArray6(arg) || isObjectLike3(arg) || isBoolean(arg) || isDate(arg) || isNull(arg);
245
+ return isObject12(arg) || isObjectLike3(arg) || isString14(arg) || isNumber2(arg) || isFunction4(arg) || isArray7(arg) || isObjectLike3(arg) || isBoolean(arg) || isDate(arg) || isNull(arg);
246
246
  };
247
247
  var isUndefined9 = (arg) => {
248
248
  return arg === void 0;
249
249
  };
250
250
  var TYPES = {
251
251
  boolean: isBoolean,
252
- array: isArray6,
252
+ array: isArray7,
253
253
  object: isObject12,
254
- string: isString13,
254
+ string: isString14,
255
255
  date: isDate,
256
256
  number: isNumber2,
257
257
  null: isNull,
@@ -11791,14 +11791,16 @@ function findComponent(el) {
11791
11791
  if (!el || !el.__ref)
11792
11792
  return;
11793
11793
  const components = el.context.components;
11794
+ const extendStr = returnStringExtend(el.extend);
11795
+ const parentChildExtendStr = returnStringExtend(el.parent.childExtend);
11794
11796
  const __componentKey = el.__ref.__componentKey || "";
11795
- const componentKey = __componentKey.split("_")[0].split(".")[0].split("+")[0];
11797
+ const componentKey = (__componentKey || extendStr || parentChildExtendStr).split("_")[0].split(".")[0].split("+")[0];
11796
11798
  if (componentKey && components[componentKey]) {
11797
11799
  return el;
11798
11800
  }
11799
11801
  return findComponent(el.parent);
11800
11802
  }
11801
- var import_utils9, DevFocus, inspectOnKey;
11803
+ var import_utils9, DevFocus, returnStringExtend, inspectOnKey;
11802
11804
  var init_devFocus = __esm({
11803
11805
  "../socket-ui/devFocus.js"() {
11804
11806
  "use strict";
@@ -11814,6 +11816,7 @@ var init_devFocus = __esm({
11814
11816
  focus: {
11815
11817
  state: {},
11816
11818
  props: (el, s) => ({
11819
+ transition: "all, defaultBezier, X",
11817
11820
  position: "fixed",
11818
11821
  hide: !s.area || !s.parent.debugging
11819
11822
  }),
@@ -11845,6 +11848,7 @@ var init_devFocus = __esm({
11845
11848
  color: "text",
11846
11849
  // color: 'blue',
11847
11850
  zIndex: "99999999",
11851
+ transition: "all, defaultBezier, X",
11848
11852
  textDecoration: "underline",
11849
11853
  fontWeight: "500",
11850
11854
  top: "100%"
@@ -11905,15 +11909,23 @@ var init_devFocus = __esm({
11905
11909
  const component = findComponent(el);
11906
11910
  if (!component || !component.__ref.__componentKey || !state.debugging)
11907
11911
  return;
11908
- send.call(el.__ref.root.data.socket, "route", JSON.stringify({
11912
+ const editor = el.context.editor;
11913
+ if (editor && editor.onInspect) {
11914
+ return editor.onInspect(component.__ref.__componentKey, el, el.state, { allowRouterWhileInspect: true });
11915
+ }
11916
+ send.call(el.context.socket, "route", JSON.stringify({
11909
11917
  componentKey: `${component.__ref.__componentKey}`
11910
11918
  }));
11911
11919
  return false;
11912
11920
  }
11913
11921
  }
11914
11922
  };
11915
- inspectOnKey = (app) => {
11916
- window.onkeydown = (ev) => {
11923
+ returnStringExtend = (extend) => {
11924
+ return (0, import_utils9.isString)(extend) ? extend : (0, import_utils9.isArray)(extend) ? extend.find((extItem) => (0, import_utils9.isString)(extItem)) : "";
11925
+ };
11926
+ inspectOnKey = (app, opts) => {
11927
+ const windowOpts = opts.window || window;
11928
+ windowOpts.onkeydown = (ev) => {
11917
11929
  if (ev.altKey && ev.shiftKey) {
11918
11930
  app.state.update({ debugging: true, preventSelect: true }, {
11919
11931
  preventContentUpdate: true,
@@ -11921,7 +11933,7 @@ var init_devFocus = __esm({
11921
11933
  });
11922
11934
  }
11923
11935
  };
11924
- window.onkeyup = (ev) => {
11936
+ windowOpts.onkeyup = (ev) => {
11925
11937
  if ((!ev.altKey || !ev.shiftKey) && app.state.debugging) {
11926
11938
  app.focus.state.update({ area: false });
11927
11939
  app.state.update({ debugging: false, preventSelect: false }, {
@@ -12066,7 +12078,7 @@ var init_byld_socket = __esm({
12066
12078
  },
12067
12079
  on: {
12068
12080
  render: (el, s, ctx) => {
12069
- el.data.socket = connect(ctx.key, {
12081
+ ctx.socket = connect(ctx.key, {
12070
12082
  source: isLocalhost ? "localhost" : "client",
12071
12083
  socketUrl: isLocalhost ? "localhost:13336" : "socket.symbols.app",
12072
12084
  location: import_globals.window.location.host,
@@ -12129,7 +12141,7 @@ var init_syncExtend = __esm({
12129
12141
  return;
12130
12142
  const inspect = (0, import_utils11.isUndefined)(editor.inspect) ? (0, import_utils11.isDevelopment)() : editor.inspect;
12131
12143
  if (inspect)
12132
- (0, import_socket_ui.inspectOnKey)(root);
12144
+ (0, import_socket_ui.inspectOnKey)(root, options);
12133
12145
  };
12134
12146
  }
12135
12147
  });
@@ -16512,12 +16524,13 @@ var init_prepare = __esm({
16512
16524
  prepareUtils = (options) => {
16513
16525
  return { ...utils2, ...utils2.scratchUtils, ...options.snippets || options.utils || {} };
16514
16526
  };
16515
- preparePackages = (packages, options) => {
16516
- if (window.packages) {
16517
- window.packages = (0, import_utils15.merge)(window.packages, packages);
16527
+ preparePackages = (packages, opts) => {
16528
+ const windowOpts = opts.window || window;
16529
+ if (windowOpts.packages) {
16530
+ windowOpts.packages = (0, import_utils15.merge)(windowOpts.packages, packages);
16518
16531
  } else {
16519
- window.packages = packages;
16520
- window.require = (key) => window.packages[key];
16532
+ windowOpts.packages = packages;
16533
+ windowOpts.require = (key) => windowOpts.packages[key];
16521
16534
  }
16522
16535
  };
16523
16536
  prepareDesignSystem = (options, key) => {
@@ -16552,6 +16565,10 @@ var init_prepare = __esm({
16552
16565
  window.document = { body: {} };
16553
16566
  document = window.document;
16554
16567
  }
16568
+ if (!options.window)
16569
+ options.window = window;
16570
+ if (!options.document)
16571
+ options.document = document;
16555
16572
  return options.parent || options.document || document;
16556
16573
  };
16557
16574
  }
@@ -16637,6 +16654,7 @@ var init_createDomql = __esm({
16637
16654
  registry,
16638
16655
  emotion: emotion2,
16639
16656
  routerOptions,
16657
+ socket: options.socket,
16640
16658
  editor: options.editor,
16641
16659
  document: doc
16642
16660
  }
@@ -18387,7 +18405,7 @@ var init_Icon = __esm({
18387
18405
  const { toCamelCase: toCamelCase2 } = context && context.utils;
18388
18406
  const iconName = props4.name || props4.icon || key;
18389
18407
  const camelCase = toCamelCase2(deps.isString(iconName) ? iconName : key);
18390
- const isArray6 = camelCase.split(/([a-z])([A-Z])/g);
18408
+ const isArray7 = camelCase.split(/([a-z])([A-Z])/g);
18391
18409
  let activeIconName;
18392
18410
  if (props4.active) {
18393
18411
  activeIconName = props4[".active"].name || props4[".active"].icon;
@@ -18400,10 +18418,10 @@ var init_Icon = __esm({
18400
18418
  validIconName = activeIconName;
18401
18419
  if (ICONS[camelCase])
18402
18420
  validIconName = camelCase;
18403
- else if (ICONS[isArray6[0] + isArray6[1]])
18404
- validIconName = isArray6[0] + isArray6[1];
18405
- else if (ICONS[isArray6[0]])
18406
- validIconName = isArray6[0];
18421
+ else if (ICONS[isArray7[0] + isArray7[1]])
18422
+ validIconName = isArray7[0] + isArray7[1];
18423
+ else if (ICONS[isArray7[0]])
18424
+ validIconName = isArray7[0];
18407
18425
  else {
18408
18426
  if (verbose)
18409
18427
  console.warn("Can't find icon:", iconName, validIconName);
@@ -18926,8 +18944,8 @@ var init_Input = __esm({
18926
18944
  autocomplete: ({ props: props4 }) => props4.autocomplete,
18927
18945
  placeholder: ({ props: props4 }) => props4.placeholder,
18928
18946
  value: ({ props: props4, state, deps }) => {
18929
- const { isString: isString13, replaceLiteralsWithObjectFields: replaceLiteralsWithObjectFields2 } = deps;
18930
- if (isString13(props4.value) && props4.value.includes("{{")) {
18947
+ const { isString: isString14, replaceLiteralsWithObjectFields: replaceLiteralsWithObjectFields2 } = deps;
18948
+ if (isString14(props4.value) && props4.value.includes("{{")) {
18931
18949
  return replaceLiteralsWithObjectFields2(props4.value, state);
18932
18950
  }
18933
18951
  return props4.value;
@@ -23729,7 +23747,7 @@ var applyInspectListener2 = (root, options) => {
23729
23747
  return;
23730
23748
  const inspect = (0, import_utils33.isUndefined)(editor.inspect) ? (0, import_utils33.isDevelopment)() : editor.inspect;
23731
23749
  if (inspect)
23732
- inspectOnKey(root);
23750
+ inspectOnKey(root, options);
23733
23751
  };
23734
23752
 
23735
23753
  // src/define.js
@@ -23844,12 +23862,13 @@ var prepareComponents2 = (options) => {
23844
23862
  var prepareUtils2 = (options) => {
23845
23863
  return { ...utilImports_exports, ...import_scratch2.scratchUtils, ...options.snippets || options.utils || {} };
23846
23864
  };
23847
- var preparePackages2 = (packages, options) => {
23848
- if (window.packages) {
23849
- window.packages = (0, import_utils35.merge)(window.packages, packages);
23865
+ var preparePackages2 = (packages, opts) => {
23866
+ const windowOpts = opts.window || window;
23867
+ if (windowOpts.packages) {
23868
+ windowOpts.packages = (0, import_utils35.merge)(windowOpts.packages, packages);
23850
23869
  } else {
23851
- window.packages = packages;
23852
- window.require = (key) => window.packages[key];
23870
+ windowOpts.packages = packages;
23871
+ windowOpts.require = (key) => windowOpts.packages[key];
23853
23872
  }
23854
23873
  };
23855
23874
  var prepareDesignSystem2 = (options, key) => {
@@ -23884,6 +23903,10 @@ var prepareDocument2 = (options) => {
23884
23903
  window.document = { body: {} };
23885
23904
  document = window.document;
23886
23905
  }
23906
+ if (!options.window)
23907
+ options.window = window;
23908
+ if (!options.document)
23909
+ options.document = document;
23887
23910
  return options.parent || options.document || document;
23888
23911
  };
23889
23912
 
@@ -23923,6 +23946,7 @@ var createDomqlElement2 = (App, options) => {
23923
23946
  registry,
23924
23947
  emotion: emotion2,
23925
23948
  routerOptions,
23949
+ socket: options.socket,
23926
23950
  editor: options.editor,
23927
23951
  document: doc
23928
23952
  }
@@ -73,6 +73,7 @@ const createDomqlElement = (App, options) => {
73
73
  registry,
74
74
  emotion,
75
75
  routerOptions,
76
+ socket: options.socket,
76
77
  editor: options.editor,
77
78
  document: doc
78
79
  }
@@ -68,12 +68,13 @@ const prepareComponents = (options) => {
68
68
  const prepareUtils = (options) => {
69
69
  return { ...utils, ...utils.scratchUtils, ...options.snippets || options.utils || {} };
70
70
  };
71
- const preparePackages = (packages, options) => {
72
- if (window.packages) {
73
- window.packages = (0, import_utils.merge)(window.packages, packages);
71
+ const preparePackages = (packages, opts) => {
72
+ const windowOpts = opts.window || window;
73
+ if (windowOpts.packages) {
74
+ windowOpts.packages = (0, import_utils.merge)(windowOpts.packages, packages);
74
75
  } else {
75
- window.packages = packages;
76
- window.require = (key) => window.packages[key];
76
+ windowOpts.packages = packages;
77
+ windowOpts.require = (key) => windowOpts.packages[key];
77
78
  }
78
79
  };
79
80
  const prepareDesignSystem = (options, key) => {
@@ -108,5 +109,9 @@ const prepareDocument = (options) => {
108
109
  window.document = { body: {} };
109
110
  document = window.document;
110
111
  }
112
+ if (!options.window)
113
+ options.window = window;
114
+ if (!options.document)
115
+ options.document = document;
111
116
  return options.parent || options.document || document;
112
117
  };
@@ -42,5 +42,5 @@ const applyInspectListener = (root, options) => {
42
42
  return;
43
43
  const inspect = (0, import_utils.isUndefined)(editor.inspect) ? (0, import_utils.isDevelopment)() : editor.inspect;
44
44
  if (inspect)
45
- (0, import_socket_ui.inspectOnKey)(root);
45
+ (0, import_socket_ui.inspectOnKey)(root, options);
46
46
  };
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@symbo.ls/create",
3
- "version": "2.11.353",
3
+ "version": "2.11.354",
4
4
  "license": "MIT",
5
- "gitHead": "c5d01a30797fc044b539a5309a879f6b249e3888",
5
+ "gitHead": "353f21d352f69ac5a9b5bad4d72f379d272005ff",
6
6
  "files": [
7
7
  "src",
8
8
  "dist"
@@ -49,6 +49,7 @@ export const createDomqlElement = (App, options) => {
49
49
  registry,
50
50
  emotion,
51
51
  routerOptions,
52
+ socket: options.socket,
52
53
  editor: options.editor,
53
54
  document: doc
54
55
  }
package/src/prepare.js CHANGED
@@ -35,12 +35,13 @@ export const prepareUtils = options => {
35
35
  return { ...utils, ...utils.scratchUtils, ...(options.snippets || options.utils || {}) }
36
36
  }
37
37
 
38
- export const preparePackages = (packages, options) => {
39
- if (window.packages) {
40
- window.packages = merge(window.packages, packages)
38
+ export const preparePackages = (packages, opts) => {
39
+ const windowOpts = opts.window || window
40
+ if (windowOpts.packages) {
41
+ windowOpts.packages = merge(windowOpts.packages, packages)
41
42
  } else {
42
- window.packages = packages
43
- window.require = (key) => window.packages[key]
43
+ windowOpts.packages = packages
44
+ windowOpts.require = (key) => windowOpts.packages[key]
44
45
  }
45
46
  }
46
47
 
@@ -76,5 +77,7 @@ export const prepareDocument = options => {
76
77
  if (!window.document) window.document = { body: {} }
77
78
  document = window.document // eslint-disable-line
78
79
  }
80
+ if (!options.window) options.window = window
81
+ if (!options.document) options.document = document
79
82
  return options.parent || options.document || document
80
83
  }
package/src/syncExtend.js CHANGED
@@ -17,5 +17,5 @@ export const applyInspectListener = (root, options) => {
17
17
  const { editor } = options
18
18
  if (!editor) return
19
19
  const inspect = isUndefined(editor.inspect) ? isDevelopment() : editor.inspect
20
- if (inspect) inspectOnKey(root)
20
+ if (inspect) inspectOnKey(root, options)
21
21
  }