@_unit/unit 1.0.7 → 1.0.8

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.
Files changed (57) hide show
  1. package/build/web.js +1201 -0
  2. package/package.json +1 -1
  3. package/public/_worker.js +294 -103
  4. package/public/_worker.js.map +4 -4
  5. package/public/app/html/index.html +74 -0
  6. package/public/build.json +1 -1
  7. package/public/index.js +297 -103
  8. package/public/index.js.map +4 -4
  9. package/src/API.ts +1 -0
  10. package/src/Class/Graph/index.ts +14 -1
  11. package/src/Class/Graph/interface.ts +7 -0
  12. package/src/Class/Graph/moveSubgraph.ts +25 -25
  13. package/src/client/component.ts +18 -7
  14. package/src/client/extractStyle.ts +161 -0
  15. package/src/client/isTextLike.ts +16 -0
  16. package/src/client/platform/web/api/document.ts +3 -0
  17. package/src/debug/graph/watchGraphInternal.ts +2 -0
  18. package/src/debug/graph/watchGraphSetUnitPinSetIdEvent.ts +39 -0
  19. package/src/docs/concept/README.md +8 -2
  20. package/src/interface.ts +1 -0
  21. package/src/script/build/client.ts +4 -2
  22. package/src/spec/Lazy.ts +10 -2
  23. package/src/spec/util.ts +4 -0
  24. package/src/system/_classes.ts +2 -2
  25. package/src/system/_ids.ts +1 -1
  26. package/src/system/_specs.ts +1 -1
  27. package/src/system/core/unit/MergeInput/spec.json +1 -1
  28. package/src/system/globalComponent.ts +29 -0
  29. package/src/system/platform/api/canvas/AddRect/index.ts +2 -6
  30. package/src/system/platform/api/canvas/ToBlob/index.ts +5 -1
  31. package/src/system/platform/api/media/MediaRecorder/index.ts +6 -0
  32. package/src/system/platform/api/media/RequestPictureInPicture/index.ts +10 -5
  33. package/src/system/platform/api/media/image/{BlobToBitmap → ImageToBitmap}/index.ts +10 -10
  34. package/src/system/platform/api/media/image/{BlobToBitmap → ImageToBitmap}/spec.json +9 -18
  35. package/src/system/platform/component/Iframe/Component.ts +2 -0
  36. package/src/system/platform/component/Inherit/Component.ts +0 -18
  37. package/src/system/platform/component/app/Editor/Component.ts +214 -77
  38. package/src/system/platform/component/app/GUI/Component.ts +19 -4
  39. package/src/system/platform/component/canvas/Canvas/index.ts +2 -2
  40. package/src/system/platform/component/media/Video/index.ts +15 -2
  41. package/src/system/platform/core/SetCurrentTime/spec.json +1 -1
  42. package/src/system/platform/core/SetScale/spec.json +1 -1
  43. package/src/system/platform/core/api/location/LocationQuery/spec.json +1 -1
  44. package/src/system/platform/core/asset/IconNames/spec.json +1 -1
  45. package/src/system/platform/core/canvas/DownloadBlob/spec.json +1 -1
  46. package/src/system/platform/core/component/Charcode/spec.json +1 -1
  47. package/src/system/platform/core/download/DownloadGraph/spec.json +1 -1
  48. package/src/system/platform/core/math/geometry/trigonometry/Hypotenuse/spec.json +1 -1
  49. package/src/system/platform/core/math/power/Pow2/spec.json +1 -1
  50. package/src/system/platform/core/string/RemoveNewLine/spec.json +1 -1
  51. package/src/test/system/core/MergeSort.ts +1 -1
  52. package/src/types/GraphSpec.ts +0 -1
  53. package/src/types/interface/B.ts +3 -1
  54. package/src/types/interface/G.ts +8 -0
  55. package/src/types/interface/async/$G.ts +3 -0
  56. package/src/types/interface/async/AsyncG.ts +10 -0
  57. package/public/metadata.mp4 +0 -0
@@ -175,7 +175,7 @@ export default class Canvas
175
175
  try {
176
176
  this._offscreen.width = data
177
177
  } catch (err) {
178
- console.log(err)
178
+ // console.log(err)
179
179
  //
180
180
  }
181
181
  // this._component.setProp('width', data)
@@ -188,7 +188,7 @@ export default class Canvas
188
188
  try {
189
189
  this._offscreen.height = data
190
190
  } catch (err) {
191
- console.log(err)
191
+ // console.log(err)
192
192
  //
193
193
  }
194
194
  // this._component.setProp('height', data)
@@ -1,6 +1,5 @@
1
1
  import { ElementEE, Element_ } from '../../../../../Class/Element'
2
2
  import { Unit } from '../../../../../Class/Unit'
3
- import { APINotSupportedError } from '../../../../../exception/APINotImplementedError'
4
3
  import { System } from '../../../../../system'
5
4
  import { Callback } from '../../../../../types/Callback'
6
5
  import { CS } from '../../../../../types/interface/CS'
@@ -52,7 +51,21 @@ export default class Video
52
51
  async captureStream({ frameRate }: CSOpt): Promise<MediaStream> {
53
52
  // TODO
54
53
  // const stream = await this._element.captureStream({ frameRate })
55
- throw new APINotSupportedError('Video Capture')
54
+ // throw new APINotSupportedError('Video Capture')
55
+
56
+ const localComponents = this.__system.getLocalComponents(this.__global_id)
57
+
58
+ const firstLocalComponent: any = localComponents[0]
59
+
60
+ if (firstLocalComponent) {
61
+ return firstLocalComponent.$element.captureStream({ frameRate })
62
+ }
63
+
64
+ return new Promise((resolve) => {
65
+ this.__system.emitter.addListener(this.__global_id, (localComponent) => {
66
+ resolve(localComponent.$element.captureStream({ frameRate }))
67
+ })
68
+ })
56
69
  }
57
70
 
58
71
  async image(): Promise<any> {
@@ -1,5 +1,5 @@
1
1
  {
2
- "type": "`U`&`G`&`C`",
2
+ "type": "`U`&`G`",
3
3
  "name": "set currentTime",
4
4
  "units": {
5
5
  "set": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "type": "`U`&`G`&`C`",
2
+ "type": "`U`&`G`",
3
3
  "name": "set scale",
4
4
  "units": {
5
5
  "setscalex": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "type": "`U`&`G`&`C`",
2
+ "type": "`U`&`G`",
3
3
  "name": "location query",
4
4
  "units": {
5
5
  "parseurl": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "type": "`U`&`G`&`C`",
2
+ "type": "`U`&`G`",
3
3
  "name": "icon names",
4
4
  "units": {
5
5
  "icons": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "type": "`U`&`G`&`C`",
2
+ "type": "`U`&`G`",
3
3
  "name": "download blob",
4
4
  "units": {
5
5
  "downloadurl": {
@@ -112,6 +112,6 @@
112
112
  ]
113
113
  },
114
114
  "id": "d0c59812-a8ec-4c53-81a9-c9725dda987e",
115
- "type": "`U`&`G`&`C`",
115
+ "type": "`U`&`G`",
116
116
  "render": true
117
117
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "type": "`U`&`G`&`C`",
2
+ "type": "`U`&`G`",
3
3
  "name": "download graph",
4
4
  "units": {
5
5
  "stringify": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "type": "`U`&`G`&`C`",
2
+ "type": "`U`&`G`",
3
3
  "name": "hypotenuse",
4
4
  "units": {
5
5
  "untitled0": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "type": "`U`&`G`&`C`",
2
+ "type": "`U`&`G`",
3
3
  "name": "pow 2",
4
4
  "units": {
5
5
  "pow": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "type": "`U`&`G`&`C`",
2
+ "type": "`U`&`G`",
3
3
  "name": "remove newline",
4
4
  "units": {
5
5
  "replace": {
@@ -1,9 +1,9 @@
1
1
  import * as assert from 'assert'
2
2
  import { watchGraphAndLog, watchUnitAndLog } from '../../../debug'
3
+ import { fromBundle } from '../../../spec/fromBundle'
3
4
  import _specs from '../../../system/_specs'
4
5
  import { countEvent } from '../../util'
5
6
  import { system } from '../../util/system'
6
- import { fromBundle } from '../../../spec/fromBundle'
7
7
 
8
8
  const bundle = require('./MergeSort.json')
9
9
  const MergeSort = fromBundle(bundle, _specs)
@@ -2,7 +2,6 @@ import { GraphComponentSpec, GraphDataSpec, GraphMetadataSpec } from '.'
2
2
  import { GraphSpecBase } from './GraphSpecBase'
3
3
  import { GraphSpecs } from './GraphSpecs'
4
4
  import { GraphUnitsSpec } from './GraphUnitsSpec'
5
- import { None } from './None'
6
5
 
7
6
  export type GraphSpec = GraphSpecBase & {
8
7
  version?: string
@@ -1,3 +1,5 @@
1
- export interface B {
1
+ import { IM } from './IM'
2
+
3
+ export interface B extends IM {
2
4
  blob(): Promise<Blob>
3
5
  }
@@ -154,6 +154,13 @@ export interface G<I = any, O = any, U_ = any> {
154
154
  setUnitSize(unitId: string, width: number, height: number): void
155
155
  setSubComponentSize(unitId: string, width: number, height: number): void
156
156
  setComponentSize(unitId: string, width: number, height: number): void
157
+ setUnitPinSetId(
158
+ unitId: string,
159
+ type: IO,
160
+ pinId: string,
161
+ newPinId: string,
162
+ ...extra: any[]
163
+ ): void
157
164
  setUnitPinConstant(
158
165
  unitId: string,
159
166
  type: IO,
@@ -271,6 +278,7 @@ export type G_EE = {
271
278
  set_unit_pin_constant: [string, IO, string, boolean, any, string[]]
272
279
  set_unit_pin_ignored: [string, IO, string, boolean, string[]]
273
280
  set_unit_pin_data: [string, IO, string, any, string[]]
281
+ set_unit_pin_set_id: [string, IO, string, string, string[]]
274
282
  remove_unit_pin_data: [string, IO, string, string[]]
275
283
  set_unit_pin_functional: [string, IO, string, boolean, string[]]
276
284
  metadata: [{ path: string[]; data: any }, string[]]
@@ -30,6 +30,7 @@ import {
30
30
  GraphSetUnitPinConstant,
31
31
  GraphSetUnitPinDataData,
32
32
  GraphSetUnitPinIgnoredData,
33
+ GraphSetUnitPinSetId,
33
34
  GraphTakeUnitErrData,
34
35
  GraphUnplugPinData,
35
36
  } from '../../../Class/Graph/interface'
@@ -79,6 +80,7 @@ export const G_METHOD_CALL_SET = [
79
80
  'setUnitPinData',
80
81
  'setUnitPinConstant',
81
82
  'setUnitPinIgnored',
83
+ 'setUnitPinSetId',
82
84
  'setPinSetId',
83
85
  'addMerge',
84
86
  'removeMerge',
@@ -137,6 +139,7 @@ export interface $G_C {
137
139
  $setPinSetFunctional(data: GraphSetPinSetFunctionalData): void
138
140
  $addMerge(data: GraphAddMergeData): void
139
141
  $removeMerge(data: GraphRemoveMergeData): void
142
+ $setUnitPinSetId(data: GraphSetUnitPinSetId): void
140
143
  $setUnitPinConstant(data: GraphSetUnitPinConstant): void
141
144
  $setUnitPinIgnored(data: GraphSetUnitPinIgnoredData): void
142
145
  $addMerges(data: GraphAddMergesData): void
@@ -30,6 +30,7 @@ import {
30
30
  GraphSetUnitPinConstant,
31
31
  GraphSetUnitPinDataData,
32
32
  GraphSetUnitPinIgnoredData,
33
+ GraphSetUnitPinSetId,
33
34
  GraphTakeUnitErrData,
34
35
  GraphUnplugPinData,
35
36
  } from '../../../Class/Graph/interface'
@@ -198,6 +199,15 @@ export const AsyncGCall = (graph: Graph): $G_C => {
198
199
  graph.setUnitPinIgnored(unitId, type, pinId, ignored)
199
200
  },
200
201
 
202
+ $setUnitPinSetId({
203
+ unitId,
204
+ type,
205
+ pinId,
206
+ nextPinId,
207
+ }: GraphSetUnitPinSetId): void {
208
+ graph.setUnitPinSetId(unitId, type, pinId, nextPinId)
209
+ },
210
+
201
211
  $addMerge({ mergeId, mergeSpec: merge }: GraphAddMergeData) {
202
212
  graph.addMerge(clone(merge), mergeId)
203
213
  },
Binary file