@snupo/jmc 1.0.62 → 1.1.0

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 (60) hide show
  1. package/LICENSE +21 -0
  2. package/dist/base.d.ts +3 -2
  3. package/dist/base.d.ts.map +1 -1
  4. package/dist/base.js +11 -13
  5. package/dist/base.js.map +1 -1
  6. package/dist/events.js +1 -0
  7. package/dist/events.js.map +1 -1
  8. package/dist/h.d.ts +14 -7
  9. package/dist/h.d.ts.map +1 -1
  10. package/dist/h.js +7 -4
  11. package/dist/h.js.map +1 -1
  12. package/dist/index.d.ts +2 -1
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +2 -1
  15. package/dist/index.js.map +1 -1
  16. package/dist/jmc.d.ts +1 -12
  17. package/dist/jmc.d.ts.map +1 -1
  18. package/dist/jmc.js +80 -119
  19. package/dist/jmc.js.map +1 -1
  20. package/dist/jsx-dev-runtime.d.ts +5 -0
  21. package/dist/jsx-dev-runtime.d.ts.map +1 -0
  22. package/dist/jsx-dev-runtime.js +6 -0
  23. package/dist/jsx-dev-runtime.js.map +1 -0
  24. package/dist/jsx-runtime.d.ts +14 -0
  25. package/dist/jsx-runtime.d.ts.map +1 -0
  26. package/dist/jsx-runtime.js +10 -0
  27. package/dist/jsx-runtime.js.map +1 -0
  28. package/dist/jsx.d.ts +39 -46
  29. package/dist/jsx.d.ts.map +1 -1
  30. package/dist/jsx.js.map +1 -1
  31. package/dist/lib.d.ts +5 -3
  32. package/dist/lib.d.ts.map +1 -1
  33. package/dist/lib.js +4 -5
  34. package/dist/lib.js.map +1 -1
  35. package/dist/props.d.ts +11 -0
  36. package/dist/props.d.ts.map +1 -0
  37. package/dist/props.js +43 -0
  38. package/dist/props.js.map +1 -0
  39. package/dist/update.d.ts +10 -0
  40. package/dist/update.d.ts.map +1 -0
  41. package/dist/update.js +48 -0
  42. package/dist/update.js.map +1 -0
  43. package/package.json +29 -3
  44. package/readme.md +303 -34
  45. package/src/base.ts +11 -15
  46. package/src/events.ts +1 -1
  47. package/src/h.ts +29 -18
  48. package/src/index.ts +2 -1
  49. package/src/jmc.ts +90 -138
  50. package/src/jsx-dev-runtime.ts +8 -0
  51. package/src/jsx-runtime.ts +17 -0
  52. package/src/jsx.ts +18 -30
  53. package/src/lib.ts +10 -8
  54. package/src/props.ts +43 -0
  55. package/src/update.ts +54 -0
  56. package/dist/updateview.d.ts +0 -17
  57. package/dist/updateview.d.ts.map +0 -1
  58. package/dist/updateview.js +0 -43
  59. package/dist/updateview.js.map +0 -1
  60. package/src/updateview.ts +0 -48
@@ -1,17 +0,0 @@
1
- import { Command } from "./jmc";
2
- /**
3
- * Synchronously processes all pending commands queued in pendingCommands.
4
- */
5
- export declare const flush: () => void;
6
- /**
7
- * Asynchronously batches view updates.
8
- * Multiple synchronous calls collapse into a single execution during the microtask queue tick.
9
- */
10
- export declare const updateviewmicro: (...args: Command[]) => void;
11
- export declare const updateviewaf: (...args: Command[]) => void;
12
- /**
13
- * Synchronously updates the view immediately.
14
- * Pushes new commands onto the queue and flushes all pending commands in a single batch.
15
- */
16
- export declare const updateviewsync: (...args: Command[]) => void;
17
- //# sourceMappingURL=updateview.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"updateview.d.ts","sourceRoot":"","sources":["../src/updateview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAc,MAAM,OAAO,CAAA;AAK3C;;GAEG;AACH,eAAO,MAAM,KAAK,QAAO,IAUxB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,GAAG,MAAM,OAAO,EAAE,KAAG,IAMpD,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,GAAG,MAAM,OAAO,EAAE,KAAG,IAMjD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAI,GAAG,MAAM,OAAO,EAAE,KAAG,IAGnD,CAAA"}
@@ -1,43 +0,0 @@
1
- import { updateview } from "./jmc";
2
- let pendings = [];
3
- let isScheduled = false;
4
- /**
5
- * Synchronously processes all pending commands queued in pendingCommands.
6
- */
7
- export const flush = () => {
8
- if (pendings.length === 0)
9
- return;
10
- // Clear scheduling state and extract queued commands
11
- isScheduled = false;
12
- const cmds = [...new Set(pendings)]; // this is guaranteed stable, keeping order
13
- pendings = [];
14
- // Execute the single, unified update
15
- updateview(...cmds);
16
- };
17
- /**
18
- * Asynchronously batches view updates.
19
- * Multiple synchronous calls collapse into a single execution during the microtask queue tick.
20
- */
21
- export const updateviewmicro = (...args) => {
22
- pendings.push(...args);
23
- if (!isScheduled) {
24
- isScheduled = true;
25
- queueMicrotask(flush);
26
- }
27
- };
28
- export const updateviewaf = (...args) => {
29
- pendings.push(...args);
30
- if (!isScheduled) {
31
- isScheduled = true;
32
- requestAnimationFrame(flush);
33
- }
34
- };
35
- /**
36
- * Synchronously updates the view immediately.
37
- * Pushes new commands onto the queue and flushes all pending commands in a single batch.
38
- */
39
- export const updateviewsync = (...args) => {
40
- pendings.push(...args);
41
- flush();
42
- };
43
- //# sourceMappingURL=updateview.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"updateview.js","sourceRoot":"","sources":["../src/updateview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,UAAU,EAAE,MAAM,OAAO,CAAA;AAE3C,IAAI,QAAQ,GAAc,EAAE,CAAA;AAC5B,IAAI,WAAW,GAAG,KAAK,CAAA;AAEvB;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,GAAS,EAAE;IAC5B,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAM;IAEjC,qDAAqD;IACrD,WAAW,GAAG,KAAK,CAAA;IACnB,MAAM,IAAI,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAA,CAAC,2CAA2C;IAC/E,QAAQ,GAAG,EAAE,CAAA;IAEb,qCAAqC;IACrC,UAAU,CAAC,GAAG,IAAI,CAAC,CAAA;AACvB,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,GAAG,IAAe,EAAQ,EAAE;IACxD,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAA;IACtB,IAAI,CAAC,WAAW,EAAE,CAAC;QACf,WAAW,GAAG,IAAI,CAAA;QAClB,cAAc,CAAC,KAAK,CAAC,CAAA;IACzB,CAAC;AACL,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,GAAG,IAAe,EAAQ,EAAE;IACrD,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAA;IACtB,IAAI,CAAC,WAAW,EAAE,CAAC;QACf,WAAW,GAAG,IAAI,CAAA;QAClB,qBAAqB,CAAC,KAAK,CAAC,CAAA;IAChC,CAAC;AACL,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAG,IAAe,EAAQ,EAAE;IACvD,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAA;IACtB,KAAK,EAAE,CAAA;AACX,CAAC,CAAA","sourcesContent":["import { Command, updateview } from \"./jmc\"\r\n\r\nlet pendings: Command[] = []\r\nlet isScheduled = false\r\n\r\n/**\r\n * Synchronously processes all pending commands queued in pendingCommands.\r\n */\r\nexport const flush = (): void => {\r\n if (pendings.length === 0) return\r\n\r\n // Clear scheduling state and extract queued commands\r\n isScheduled = false\r\n const cmds = [...new Set(pendings)] // this is guaranteed stable, keeping order\r\n pendings = []\r\n\r\n // Execute the single, unified update\r\n updateview(...cmds)\r\n}\r\n\r\n/**\r\n * Asynchronously batches view updates.\r\n * Multiple synchronous calls collapse into a single execution during the microtask queue tick.\r\n */\r\nexport const updateviewmicro = (...args: Command[]): void => {\r\n pendings.push(...args)\r\n if (!isScheduled) {\r\n isScheduled = true\r\n queueMicrotask(flush)\r\n }\r\n}\r\n\r\nexport const updateviewaf = (...args: Command[]): void => {\r\n pendings.push(...args)\r\n if (!isScheduled) {\r\n isScheduled = true\r\n requestAnimationFrame(flush)\r\n }\r\n}\r\n\r\n/**\r\n * Synchronously updates the view immediately.\r\n * Pushes new commands onto the queue and flushes all pending commands in a single batch.\r\n */\r\nexport const updateviewsync = (...args: Command[]): void => {\r\n pendings.push(...args)\r\n flush()\r\n}\r\n"]}
package/src/updateview.ts DELETED
@@ -1,48 +0,0 @@
1
- import { Command, updateview } from "./jmc"
2
-
3
- let pendings: Command[] = []
4
- let isScheduled = false
5
-
6
- /**
7
- * Synchronously processes all pending commands queued in pendingCommands.
8
- */
9
- export const flush = (): void => {
10
- if (pendings.length === 0) return
11
-
12
- // Clear scheduling state and extract queued commands
13
- isScheduled = false
14
- const cmds = [...new Set(pendings)] // this is guaranteed stable, keeping order
15
- pendings = []
16
-
17
- // Execute the single, unified update
18
- updateview(...cmds)
19
- }
20
-
21
- /**
22
- * Asynchronously batches view updates.
23
- * Multiple synchronous calls collapse into a single execution during the microtask queue tick.
24
- */
25
- export const updateviewmicro = (...args: Command[]): void => {
26
- pendings.push(...args)
27
- if (!isScheduled) {
28
- isScheduled = true
29
- queueMicrotask(flush)
30
- }
31
- }
32
-
33
- export const updateviewaf = (...args: Command[]): void => {
34
- pendings.push(...args)
35
- if (!isScheduled) {
36
- isScheduled = true
37
- requestAnimationFrame(flush)
38
- }
39
- }
40
-
41
- /**
42
- * Synchronously updates the view immediately.
43
- * Pushes new commands onto the queue and flushes all pending commands in a single batch.
44
- */
45
- export const updateviewsync = (...args: Command[]): void => {
46
- pendings.push(...args)
47
- flush()
48
- }