@coorax/core 0.0.0-canary.0 → 0.0.0-canary.2

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 (143) hide show
  1. package/dist/base/classes/component.class.d.ts +23 -0
  2. package/dist/base/classes/container.class.d.ts +17 -0
  3. package/dist/base/classes/field.class.d.ts +15 -0
  4. package/dist/base/classes/tnode.class.d.ts +14 -0
  5. package/{src/base/index.ts → dist/base/index.d.ts} +0 -4
  6. package/dist/base/types/components/components.d.ts +13 -0
  7. package/dist/base/types/container/container.d.ts +27 -0
  8. package/dist/base/types/container/division.types.d.ts +3 -0
  9. package/{src/base/types/container/section.types.ts → dist/base/types/container/section.types.d.ts} +2 -2
  10. package/{src/base/types/container/ul-list.types.ts → dist/base/types/container/ul-list.types.d.ts} +2 -2
  11. package/dist/base/types/css.types.d.ts +23 -0
  12. package/dist/base/types/field/divider.types.d.ts +3 -0
  13. package/dist/base/types/field/field.blockquote.types.d.ts +4 -0
  14. package/dist/base/types/field/field.d.ts +50 -0
  15. package/dist/base/types/field/field.image.types.d.ts +3 -0
  16. package/{src/base/types/field/field.media.types.ts → dist/base/types/field/field.media.types.d.ts} +2 -3
  17. package/{src/base/types/field/field.text.types.ts → dist/base/types/field/field.text.types.d.ts} +4 -5
  18. package/dist/base/types/field/field.video.types.d.ts +8 -0
  19. package/dist/base/types/field/fields.iframe.types.d.ts +7 -0
  20. package/{src/base/types/field/heading.types.ts → dist/base/types/field/heading.types.d.ts} +2 -2
  21. package/{src/base/types/field/paragraph.types.ts → dist/base/types/field/paragraph.types.d.ts} +2 -2
  22. package/dist/base/types/global.types.d.ts +26 -0
  23. package/{src/base/types/node/span.types.ts → dist/base/types/node/link.types.d.ts} +2 -2
  24. package/{src/base/types/node/node.ts → dist/base/types/node/node.d.ts} +13 -17
  25. package/{src/base/types/node/link.types.ts → dist/base/types/node/span.types.d.ts} +2 -2
  26. package/dist/base/types/tree/tree.d.ts +24 -0
  27. package/dist/constants/field.constants.d.ts +1 -0
  28. package/dist/constants/index.d.ts +1 -0
  29. package/{src/engine/engine.ts → dist/engine/engine.d.ts} +20 -24
  30. package/dist/engine/engine.test.d.ts +1 -0
  31. package/{src/index.ts → dist/index.d.ts} +1 -2
  32. package/dist/index.js +3252 -0
  33. package/dist/modules/caption/caption.module.d.ts +35 -0
  34. package/dist/modules/caption/caption.test.d.ts +1 -0
  35. package/dist/modules/code/code.module.d.ts +37 -0
  36. package/dist/modules/deletion/deletion.module.d.ts +26 -0
  37. package/dist/modules/editor/editor.module.d.ts +44 -0
  38. package/dist/modules/focus/focus.module.d.ts +54 -0
  39. package/dist/modules/history/history.module.d.ts +41 -0
  40. package/dist/modules/hover/hover.module.d.ts +53 -0
  41. package/{src/modules/index.ts → dist/modules/index.d.ts} +3 -1
  42. package/dist/modules/insertion/insertion.module.d.ts +71 -0
  43. package/dist/modules/modules-manager.d.ts +43 -0
  44. package/{src/modules/modules.types.ts → dist/modules/modules.types.d.ts} +25 -30
  45. package/dist/modules/selection/selection.module.d.ts +60 -0
  46. package/dist/modules/selection/selection.test.d.ts +1 -0
  47. package/dist/modules/text-editing/text-editing.constants.d.ts +2 -0
  48. package/dist/modules/text-editing/text-editing.module.d.ts +82 -0
  49. package/dist/modules/text-editing/text-editing.utils.d.ts +6 -0
  50. package/dist/services/commandsbus/commandsbus.d.ts +53 -0
  51. package/dist/services/commandsbus/commandsbus.test.d.ts +17 -0
  52. package/dist/services/document/document.d.ts +44 -0
  53. package/dist/services/eventbus/eventbus.d.ts +86 -0
  54. package/dist/services/eventbus/eventbus.test.d.ts +8 -0
  55. package/dist/services/eventbus/subscriber.d.ts +18 -0
  56. package/dist/services/mutations/mutations.d.ts +43 -0
  57. package/dist/services/mutations/mutations.errors.d.ts +6 -0
  58. package/dist/services/mutations/mutations.test.d.ts +1 -0
  59. package/dist/services/shortcuts/shortcuts.d.ts +4 -0
  60. package/dist/services/state/state.d.ts +20 -0
  61. package/dist/services/state/state.errors.d.ts +6 -0
  62. package/dist/services/tasks/tasks.service.d.ts +106 -0
  63. package/dist/services/tasks/tasks.service.test.d.ts +7 -0
  64. package/dist/services/text-marks/index.d.ts +1 -0
  65. package/{src/services/text-marks/marks.types.ts → dist/services/text-marks/marks.types.d.ts} +20 -23
  66. package/dist/services/text-marks/text-marks.d.ts +45 -0
  67. package/dist/services/ui/contributions.types.d.ts +79 -0
  68. package/dist/services/ui/default-styles.d.ts +3 -0
  69. package/{src/services/ui/index.ts → dist/services/ui/index.d.ts} +0 -1
  70. package/dist/services/ui/ui.d.ts +23 -0
  71. package/dist/services/ui/ui.errors.d.ts +3 -0
  72. package/dist/services/ui/ui.types.d.ts +25 -0
  73. package/dist/styles.css +2 -0
  74. package/dist/utils/components.utils.d.ts +10 -0
  75. package/dist/utils/container.utils.d.ts +13 -0
  76. package/dist/utils/fields.utils.d.ts +27 -0
  77. package/dist/utils/global.utils.d.ts +47 -0
  78. package/dist/utils/index.d.ts +1 -0
  79. package/dist/utils/modules.utils.d.ts +11 -0
  80. package/dist/utils/tnode.utils.d.ts +9 -0
  81. package/dist/utils/tree.utils.d.ts +11 -0
  82. package/package.json +23 -6
  83. package/styles.css +4 -4
  84. package/src/base/classes/component.class.ts +0 -68
  85. package/src/base/classes/container.class.ts +0 -57
  86. package/src/base/classes/field.class.ts +0 -42
  87. package/src/base/classes/tnode.class.ts +0 -38
  88. package/src/base/types/components/components.ts +0 -21
  89. package/src/base/types/container/container.ts +0 -37
  90. package/src/base/types/container/division.types.ts +0 -3
  91. package/src/base/types/css.types.ts +0 -33
  92. package/src/base/types/field/divider.types.ts +0 -3
  93. package/src/base/types/field/field.ts +0 -46
  94. package/src/base/types/global.types.ts +0 -45
  95. package/src/base/types/tree/tree.ts +0 -33
  96. package/src/engine/engine.test.ts +0 -27
  97. package/src/modules/editor/editor.module.ts +0 -119
  98. package/src/modules/focus/focus.module.ts +0 -185
  99. package/src/modules/history/history.module.ts +0 -60
  100. package/src/modules/hover/hover.module.ts +0 -121
  101. package/src/modules/insertion/insertion.module.ts +0 -140
  102. package/src/modules/modules-manager.ts +0 -132
  103. package/src/modules/selection/selection.module.ts +0 -174
  104. package/src/modules/selection/selection.test.ts +0 -1
  105. package/src/modules/text-editing/text-editing.constants.ts +0 -6
  106. package/src/modules/text-editing/text-editing.module.ts +0 -377
  107. package/src/modules/text-editing/text-editing.utils.ts +0 -27
  108. package/src/services/commandsbus/commandsbus.test.ts +0 -312
  109. package/src/services/commandsbus/commandsbus.ts +0 -360
  110. package/src/services/document/document.ts +0 -139
  111. package/src/services/eventbus/eventbus.test.ts +0 -144
  112. package/src/services/eventbus/eventbus.ts +0 -162
  113. package/src/services/eventbus/subscriber.ts +0 -46
  114. package/src/services/mutations/mutations.errors.ts +0 -12
  115. package/src/services/mutations/mutations.test.ts +0 -177
  116. package/src/services/mutations/mutations.ts +0 -457
  117. package/src/services/shortcuts/shortcuts.ts +0 -3
  118. package/src/services/state/state.errors.ts +0 -12
  119. package/src/services/state/state.ts +0 -64
  120. package/src/services/tasks/tasks.service.test.ts +0 -193
  121. package/src/services/tasks/tasks.service.ts +0 -288
  122. package/src/services/text-marks/index.ts +0 -2
  123. package/src/services/text-marks/text-marks.ts +0 -244
  124. package/src/services/ui/default-styles.ts +0 -93
  125. package/src/services/ui/ui.errors.ts +0 -6
  126. package/src/services/ui/ui.ts +0 -148
  127. package/src/services/ui/ui.types.ts +0 -197
  128. package/src/utils/components.utils.ts +0 -26
  129. package/src/utils/container.utils.ts +0 -59
  130. package/src/utils/fields.utils.ts +0 -118
  131. package/src/utils/global.utils.ts +0 -128
  132. package/src/utils/index.ts +0 -7
  133. package/src/utils/modules.utils.ts +0 -110
  134. package/src/utils/tnode.utils.ts +0 -48
  135. package/src/utils/tree.utils.ts +0 -120
  136. package/tsconfig.json +0 -9
  137. /package/{src/engine/index.ts → dist/engine/index.d.ts} +0 -0
  138. /package/{src/services/commandsbus/index.ts → dist/services/commandsbus/index.d.ts} +0 -0
  139. /package/{src/services/document/index.ts → dist/services/document/index.d.ts} +0 -0
  140. /package/{src/services/eventbus/index.ts → dist/services/eventbus/index.d.ts} +0 -0
  141. /package/{src/services/mutations/index.ts → dist/services/mutations/index.d.ts} +0 -0
  142. /package/{src/services/state/index.ts → dist/services/state/index.d.ts} +0 -0
  143. /package/{src/services/tasks/index.ts → dist/services/tasks/index.d.ts} +0 -0
@@ -0,0 +1,25 @@
1
+ import type { NodeCommonProps, StyleName, StylesMap } from "@coorax/schema";
2
+ import type { CommandPayload, CommandType } from "../commandsbus";
3
+ import type { StateMap } from "../state";
4
+ import type { ButtonIdMap, Contribution, SlotName } from "./contributions.types";
5
+ export type MaybePromise<T> = T | Promise<T>;
6
+ export type PayloadInterceptor<C extends CommandType> = (payload: CommandPayload<C>, ui: UIContext) => MaybePromise<CommandPayload<C> | null>;
7
+ export interface UIContext {
8
+ selection: StateMap["selection"];
9
+ focus: StateMap["focus"];
10
+ hover: StateMap["hover"];
11
+ textSelection: StateMap["textSelection"];
12
+ }
13
+ export type ContributionDisposer = () => void;
14
+ export type { StylesMap, StyleName };
15
+ export interface UiInterface {
16
+ contribute(c: Contribution): ContributionDisposer;
17
+ getSlots(name: SlotName): readonly Contribution[];
18
+ subscribe(name: SlotName, fn: () => void): ContributionDisposer;
19
+ interceptPayload<I extends keyof ButtonIdMap>(id: I, fn: PayloadInterceptor<ButtonIdMap[I] & CommandType>): ContributionDisposer;
20
+ runContribution(c: Contribution<"button">, ui: UIContext): Promise<void>;
21
+ getStyle: <T extends StyleName = StyleName>(styleName: T) => NodeCommonProps;
22
+ registerStyle: (styleName: StyleName, style: NodeCommonProps) => ContributionDisposer;
23
+ patchStyle: (styleName: StyleName, style: NodeCommonProps) => ContributionDisposer;
24
+ }
25
+ export * from "./contributions.types";
@@ -0,0 +1,2 @@
1
+ /*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
2
+ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:block))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-content:""}}}@layer theme{:root,:host{--font-sans:var(--font-sans);--font-serif:var(--font-serif);--font-mono:var(--font-mono);--color-amber-500:oklch(76.9% .188 70.08);--shadow-2xs:var(--shadow-2xs);--shadow-xs:var(--shadow-xs);--shadow-sm:var(--shadow-sm);--shadow-md:var(--shadow-md);--shadow-lg:var(--shadow-lg);--shadow-xl:var(--shadow-xl);--shadow-2xl:var(--shadow-2xl);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--shadow:var(--shadow);--color-muted-foreground:var(--muted-foreground)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*{border-color:var(--border);outline-color:var(--ring)}@supports (color:color-mix(in lab, red, red)){*{outline-color:color-mix(in oklab, var(--ring) 50%, transparent)}}body{background-color:var(--background);color:var(--foreground)}html{font-family:var(--font-sans)}}@layer components;@layer utilities{.visible{visibility:visible}.absolute{position:absolute}.relative{position:relative}.static{position:static}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.block{display:block}.flex{display:flex}.hidden{display:none}.inline-flex{display:inline-flex}.transform{transform:var(--tw-rotate-x, ) var(--tw-rotate-y, ) var(--tw-rotate-z, ) var(--tw-skew-x, ) var(--tw-skew-y, )}.border{border-style:var(--tw-border-style);border-width:1px}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/10{background-color:color-mix(in oklab, var(--color-amber-500) 10%, transparent)}}.bg-foreground{background-color:var(--foreground)}.italic{font-style:italic}.underline{text-decoration-line:underline}.ring{--tw-ring-shadow:var(--tw-ring-inset, ) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-transparent{--tw-ring-color:transparent}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.focus\:ring-primary:focus{--tw-ring-color:var(--primary)}.dark\:bg-transparent:is(.dark *){background-color:#0000}.\[\&\:empty\:before\]\:pointer-events-none:empty:before{pointer-events:none}.\[\&\:empty\:before\]\:text-muted-foreground:empty:before{color:var(--muted-foreground)}.\[\&\:empty\:before\]\:content-\[attr\(data-placeholder\)\]:empty:before{--tw-content:attr(data-placeholder);content:var(--tw-content)}}:root{--background:oklch(92.32% .0026 48.7171);--foreground:oklch(27.95% .0368 260.031);--card:oklch(96.99% .0013 106.424);--card-foreground:oklch(27.95% .0368 260.031);--popover:oklch(96.99% .0013 106.424);--popover-foreground:oklch(27.95% .0368 260.031);--primary:#6366f1;--primary-foreground:oklch(100% 0 0);--secondary:oklch(86.87% .0043 56.366);--secondary-foreground:oklch(44.61% .0263 256.802);--muted:oklch(92.32% .0026 48.7171);--muted-foreground:oklch(55.1% .0234 264.364);--accent:oklch(93.76% .026 321.939);--accent-foreground:oklch(37.29% .0306 259.733);--destructive:oklch(63.68% .2078 25.3313);--destructive-foreground:oklch(100% 0 0);--border:oklch(86.87% .0043 56.366);--input:oklch(86.87% .0043 56.366);--ring:oklch(58.54% .2041 277.117);--chart-1:oklch(58.54% .2041 277.117);--chart-2:oklch(51.06% .2301 276.966);--chart-3:oklch(45.68% .2146 277.023);--chart-4:oklch(39.84% .1773 277.366);--chart-5:oklch(35.88% .1354 278.697);--sidebar:oklch(86.87% .0043 56.366);--sidebar-foreground:oklch(27.95% .0368 260.031);--sidebar-primary:oklch(58.54% .2041 277.117);--sidebar-primary-foreground:oklch(100% 0 0);--sidebar-accent:oklch(93.76% .026 321.939);--sidebar-accent-foreground:oklch(37.29% .0306 259.733);--sidebar-border:oklch(86.87% .0043 56.366);--sidebar-ring:oklch(58.54% .2041 277.117);--font-sans:Inter, sans-serif;--font-mono:Geist Mono, monospace;--radius:1.25rem;--shadow-x:2px;--shadow-y:2px;--shadow-blur:10px;--shadow-spread:4px;--shadow-opacity:.18;--shadow-color:#95959d;--shadow-2xs:2px 2px 10px 4px #95959d17;--shadow-xs:2px 2px 10px 4px #95959d17;--shadow-sm:2px 2px 10px 4px #95959d2e, 2px 1px 2px 3px #95959d2e;--shadow:2px 2px 10px 4px #95959d2e, 2px 1px 2px 3px #95959d2e;--shadow-md:2px 2px 10px 4px #95959d2e, 2px 2px 4px 3px #95959d2e;--shadow-lg:2px 2px 10px 4px #95959d2e, 2px 4px 6px 3px #95959d2e;--shadow-xl:2px 2px 10px 4px #95959d2e, 2px 8px 10px 3px #95959d2e;--shadow-2xl:2px 2px 10px 4px #95959d73;--tracking-normal:0em;--spacing:.25rem}.dark{--background:oklch(22.44% .0074 67.437);--foreground:oklch(92.88% .0126 255.508);--card:oklch(28.01% .008 59.3379);--card-foreground:oklch(92.88% .0126 255.508);--popover:oklch(28.01% .008 59.3379);--popover-foreground:oklch(92.88% .0126 255.508);--primary:oklch(68.01% .1583 276.935);--primary-foreground:oklch(22.44% .0074 67.437);--secondary:oklch(33.59% .0077 59.4197);--secondary-foreground:oklch(87.17% .0093 258.338);--muted:oklch(22.87% .0074 67.4469);--muted-foreground:oklch(71.37% .0192 261.325);--accent:oklch(38.96% .0074 59.4734);--accent-foreground:oklch(87.17% .0093 258.338);--destructive:oklch(63.68% .2078 25.3313);--destructive-foreground:oklch(22.44% .0074 67.437);--border:oklch(33.59% .0077 59.4197);--input:oklch(33.59% .0077 59.4197);--ring:oklch(68.01% .1583 276.935);--chart-1:oklch(68.01% .1583 276.935);--chart-2:oklch(58.54% .2041 277.117);--chart-3:oklch(51.06% .2301 276.966);--chart-4:oklch(45.68% .2146 277.023);--chart-5:oklch(39.84% .1773 277.366);--sidebar:oklch(33.59% .0077 59.4197);--sidebar-foreground:oklch(92.88% .0126 255.508);--sidebar-primary:oklch(68.01% .1583 276.935);--sidebar-primary-foreground:oklch(22.44% .0074 67.437);--sidebar-accent:oklch(38.96% .0074 59.4734);--sidebar-accent-foreground:oklch(87.17% .0093 258.338);--sidebar-border:oklch(33.59% .0077 59.4197);--sidebar-ring:oklch(68.01% .1583 276.935);--font-sans:Inter, sans-serif;--font-mono:Geist Mono, monospace;--radius:1.25rem;--shadow-x:2px;--shadow-y:2px;--shadow-blur:10px;--shadow-spread:4px;--shadow-opacity:.18;--shadow-color:#000;--shadow-2xs:2px 2px 10px 4px #00000017;--shadow-xs:2px 2px 10px 4px #00000017;--shadow-sm:2px 2px 10px 4px #0000002e, 2px 1px 2px 3px #0000002e;--shadow:2px 2px 10px 4px #0000002e, 2px 1px 2px 3px #0000002e;--shadow-md:2px 2px 10px 4px #0000002e, 2px 2px 4px 3px #0000002e;--shadow-lg:2px 2px 10px 4px #0000002e, 2px 4px 6px 3px #0000002e;--shadow-xl:2px 2px 10px 4px #0000002e, 2px 8px 10px 3px #0000002e;--shadow-2xl:2px 2px 10px 4px #00000073}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-content{syntax:"*";inherits:false;initial-value:""}
@@ -0,0 +1,10 @@
1
+ import type { Component } from "../base/types/components/components";
2
+ import type { Container, ContainerType } from "../base/types/container/container";
3
+ import type { OmitComponentsMethods } from "../base/types/global.types";
4
+ declare function NewComponent<T extends ContainerType = ContainerType>(container: Omit<Container<T>, "id" | "variant">, defaultValue?: Partial<Pick<Component, "count" | "createdAt" | "updatedAt">>): Component<T>;
5
+ declare function DeserializeComponent(component: OmitComponentsMethods<Component>): Component;
6
+ export declare const ComponentsUtils: {
7
+ NewComponent: typeof NewComponent;
8
+ DeserializeComponent: typeof DeserializeComponent;
9
+ };
10
+ export {};
@@ -0,0 +1,13 @@
1
+ import type { Container, ContainerType } from "../base/types/container/container";
2
+ import type { OmitContainersMethods } from "../base/types/global.types";
3
+ declare function NewUlListContainer(defaultValue?: Partial<OmitContainersMethods<Container<"list">>>): Container<"list">;
4
+ declare function NewSectionContainer(defaultValue?: Partial<OmitContainersMethods<Container<"section">>>): Container<"section">;
5
+ declare function NewContainer<T extends ContainerType = ContainerType>(type: T, defaultValue?: Partial<OmitContainersMethods<Container<T>>>): Container;
6
+ declare function DeserializeContainer(container: OmitContainersMethods<Container>): Container;
7
+ export declare const ContainersUtils: {
8
+ NewContainer: typeof NewContainer;
9
+ DeserializeContainer: typeof DeserializeContainer;
10
+ NewUlListContainer: typeof NewUlListContainer;
11
+ NewSectionContainer: typeof NewSectionContainer;
12
+ };
13
+ export {};
@@ -0,0 +1,27 @@
1
+ import type { Block } from "../base";
2
+ import type { Field, FieldTag, FieldType } from "../base/types/field/field";
3
+ import type { OmitFieldsMethods } from "../base/types/global.types";
4
+ export declare function isEditableField<T extends Field = Field>(block: Block): block is T;
5
+ export declare function isEditableType<T extends FieldType = FieldType>(type: T): boolean;
6
+ export declare function isMediaField<T extends Field = Field>(block: Block): block is T;
7
+ export declare function isMediaType<T extends FieldType = FieldType>(type: T): boolean;
8
+ export declare function getIframeSrc(value: string): string | null;
9
+ declare function NewTextField(defaultValue?: Partial<OmitFieldsMethods<Field<"text", FieldTag>>>): Field<"text">;
10
+ declare function NewHeadingField(defaultValue?: Partial<OmitFieldsMethods<Field<"heading", FieldTag>>>): Field<"heading">;
11
+ declare function NewImageField(defaultValue?: Partial<OmitFieldsMethods<Field<"image", FieldTag>>>): Field<"image">;
12
+ declare function NewIFrameField(defaultValue?: Partial<OmitFieldsMethods<Field<"iframe", FieldTag>>>): Field<"iframe">;
13
+ declare function NewBlockquoteField(defaultValue?: Partial<OmitFieldsMethods<Field<"blockquote", FieldTag>>>): Field<"blockquote">;
14
+ declare function NewDividerField(defaultValue?: Partial<OmitFieldsMethods<Field<"divider", FieldTag>>>): Field<"divider">;
15
+ declare function NewField<T extends FieldType = FieldType, A extends FieldTag = FieldTag>(type: T, defaultValue?: Partial<OmitFieldsMethods<Field<T, A>>>): Field;
16
+ declare function DeserializeField(field: OmitFieldsMethods<Field>): Field;
17
+ export declare const FieldsUtils: {
18
+ NewField: typeof NewField;
19
+ DeserializeField: typeof DeserializeField;
20
+ NewTextField: typeof NewTextField;
21
+ NewHeadingField: typeof NewHeadingField;
22
+ NewImageField: typeof NewImageField;
23
+ NewDividerField: typeof NewDividerField;
24
+ NewIFrameField: typeof NewIFrameField;
25
+ NewBlockquoteField: typeof NewBlockquoteField;
26
+ };
27
+ export {};
@@ -0,0 +1,47 @@
1
+ declare function generateRandomId(): string;
2
+ export type CustomID<T extends string> = `${T}:${string}-${string}-${string}-${string}-${string}`;
3
+ declare function generateId<T extends string>(prefix: T): CustomID<T>;
4
+ declare function generateFieldId(): `field:${string}-${string}-${string}-${string}-${string}`;
5
+ declare function generateTNodeId(): `tnode:${string}-${string}-${string}-${string}-${string}`;
6
+ declare function generateContainerId(): `container:${string}-${string}-${string}-${string}-${string}`;
7
+ declare function generateComponentId(): `component:${string}-${string}-${string}-${string}-${string}`;
8
+ declare function generateTreeId(): `tree:${string}-${string}-${string}-${string}-${string}`;
9
+ declare function generateSubscriberId(): `subscriber:${string}-${string}-${string}-${string}-${string}`;
10
+ declare function Capitalize(value: string): string;
11
+ type EntriesKeyValuePair<T extends object, K extends keyof T = keyof T> = [K, T[K]][];
12
+ /**
13
+ * Because the native `Object.entries` dont infer correctly
14
+ * the return type, the `keys` are always string.
15
+ * So now if you pass a `Record<Key, Value>`, the Key type
16
+ * will be inferred correctly
17
+ *
18
+ * @param obj `object`
19
+ * @returns `EntriesKeyValuePair<T>`
20
+ */
21
+ declare function ObjectEntries<T extends object>(obj: T): EntriesKeyValuePair<T>;
22
+ export declare class CustomObject<T extends object> {
23
+ obj: T;
24
+ constructor(obj: T);
25
+ filter(predicate: (value: T[keyof T], key: keyof T) => boolean): CustomObject<Partial<T>>;
26
+ pick<K extends keyof T>(...keys: K[]): CustomObject<Pick<T, K>>;
27
+ get size(): number;
28
+ has<K extends keyof T>(key: K): boolean;
29
+ get keys(): (keyof T)[];
30
+ get<K extends keyof T>(key: K): T[K];
31
+ baseObject(): T;
32
+ }
33
+ export declare function areObjectsTheSame(objA: object, objB: object): boolean;
34
+ export declare const UTILS: {
35
+ generateRandomId: typeof generateRandomId;
36
+ generateId: typeof generateId;
37
+ generateContainerId: typeof generateContainerId;
38
+ generateFieldId: typeof generateFieldId;
39
+ generateTreeId: typeof generateTreeId;
40
+ generateSubscriberId: typeof generateSubscriberId;
41
+ generateComponentId: typeof generateComponentId;
42
+ Capitalize: typeof Capitalize;
43
+ generateTNodeId: typeof generateTNodeId;
44
+ ObjectEntries: typeof ObjectEntries;
45
+ isPlainObject: (v: unknown) => v is Record<string, unknown>;
46
+ };
47
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./modules.utils";
@@ -0,0 +1,11 @@
1
+ import type { TServices } from "../engine/engine";
2
+ import type { ModuleDisposer, TModuleCtx } from "../modules";
3
+ import type { ModuleName } from "../modules/modules-manager";
4
+ declare function createScopedTCtx(engine: TServices, moduleName: ModuleName): {
5
+ ctx: TModuleCtx;
6
+ dispose: ModuleDisposer;
7
+ };
8
+ export declare const ModuleUtils: {
9
+ createScopedTCtx: typeof createScopedTCtx;
10
+ };
11
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { OmitTNodesMethods } from "../base/types/global.types";
2
+ import type { TNode, TNodeType } from "../base/types/node/node";
3
+ declare function NewTNode<T extends TNodeType = TNodeType>(type: T, defaultValue?: Partial<OmitTNodesMethods<TNode<T>>>): TNode;
4
+ declare function DeserializeTNode(tnode: OmitTNodesMethods<TNode>): TNode;
5
+ export declare const TNodesUtils: {
6
+ NewTNode: typeof NewTNode;
7
+ DeserializeTNode: typeof DeserializeTNode;
8
+ };
9
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { BlockId, CoraxTree, JSONTree } from "../base/types/tree/tree";
2
+ export declare function SerializeTree(tree: CoraxTree): JSONTree;
3
+ export declare function DeserializeTree(tree: JSONTree): CoraxTree;
4
+ export declare function GetDefaultTree(): CoraxTree;
5
+ export type TreeDiff = {
6
+ added: ReadonlySet<BlockId>;
7
+ removed: ReadonlySet<BlockId>;
8
+ changed: ReadonlySet<BlockId>;
9
+ orderChanged: boolean;
10
+ };
11
+ export declare function coraxTreeDiffing(prev: CoraxTree, next: CoraxTree): TreeDiff;
package/package.json CHANGED
@@ -1,10 +1,22 @@
1
1
  {
2
2
  "name": "@coorax/core",
3
- "version": "0.0.0-canary.0",
3
+ "version": "0.0.0-canary.2",
4
4
  "private": false,
5
+ "files": [
6
+ "dist",
7
+ "styles.css"
8
+ ],
5
9
  "type": "module",
10
+ "main": "./dist/index.js",
11
+ "module": "./dist/index.js",
12
+ "types": "./dist/index.d.ts",
6
13
  "exports": {
7
- ".": "./src/index.ts",
14
+ ".": {
15
+ "source": "./src/index.ts",
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js",
18
+ "default": "./dist/index.js"
19
+ },
8
20
  "./styles.css": "./styles.css"
9
21
  },
10
22
  "publishConfig": {
@@ -17,21 +29,26 @@
17
29
  "fmt:check": "oxfmt --check",
18
30
  "vtest": "vitest",
19
31
  "typecheck": "tsc --noEmit",
20
- "build": "tsc --emitDeclarationOnly --declaration --outDir dist && bun build ./src/index.ts --outdir ./dist --target node",
32
+ "build:css": "bunx @tailwindcss/cli -i ./styles.css -o ./dist/styles.css --minify",
33
+ "build:types": "tsc --emitDeclarationOnly",
34
+ "build:js": "bun build ./src/index.ts --outdir ./dist --target browser --external lodash --external cn",
35
+ "build": "bun run build:types && bun run build:js && bun run build:css",
21
36
  "prepublishOnly": "bun run build"
22
37
  },
23
38
  "dependencies": {
39
+ "@coorax/schema": "0.0.0-canary.1",
24
40
  "@fontsource-variable/geist": "^5.3.0",
25
- "@tailwindcss/vite": "4.3.3",
41
+ "@tailwindcss/cli": "^4.3.5",
26
42
  "cn": "^0.4.0",
27
- "lodash": "^4.18.1",
28
- "tailwindcss": "4.3.3"
43
+ "lodash": "^4.18.1"
29
44
  },
30
45
  "devDependencies": {
46
+ "@tailwindcss/vite": "4.3.3",
31
47
  "@types/lodash": "^4.17.27",
32
48
  "csstype": "^3.2.3",
33
49
  "oxfmt": "^0.71.0",
34
50
  "oxlint": "^1.86.0",
51
+ "tailwindcss": "4.3.3",
35
52
  "typescript": "~6.0.2",
36
53
  "vite": "^8.3.0",
37
54
  "vitest": "^5.0.3"
package/styles.css CHANGED
@@ -1,8 +1,6 @@
1
- @import url("https://fonts.googleapis.com/css2?family=Geist+Mono:ital,wght@0,100..900;1,100..900&family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap");
2
- @import "tw-animate-css";
3
- @import "@fontsource-variable/geist";
4
1
  @import "tailwindcss";
5
- @source "./src/services/ui";
2
+ @source "./src";
3
+ @source "../schema/src";
6
4
 
7
5
  @custom-variant dark (&:is(.dark *));
8
6
 
@@ -163,6 +161,8 @@
163
161
  --shadow-lg: var(--shadow-lg);
164
162
  --shadow-xl: var(--shadow-xl);
165
163
  --shadow-2xl: var(--shadow-2xl);
164
+
165
+ --ease-damping: cubic-bezier(0.34, 1.56, 0.64, 1);
166
166
  }
167
167
 
168
168
  @layer base {
@@ -1,68 +0,0 @@
1
- import type { ContainerProps, ContainerTag, ContainerType } from "../types/container/container.ts";
2
- import type { Component, ComponentId } from "../types/components/components.ts";
3
- import type { BlockId, CoraxTree } from "../types/tree/tree.ts";
4
- import type { OmitComponentsMethods } from "../types/global.types.ts";
5
-
6
- export class ComponentClass<
7
- TType extends ContainerType = ContainerType,
8
- TTag extends ContainerTag = ContainerTag,
9
- > implements Component<TType, TTag> {
10
- id: ComponentId;
11
- name: string;
12
- tag: TTag;
13
- type: TType;
14
- props: ContainerProps<TTag>;
15
- variant = "component" as const;
16
- order: Set<BlockId>;
17
- instanceId?: ComponentId;
18
- count: number;
19
- updatedAt: number;
20
- createdAt: number;
21
-
22
- constructor(component: OmitComponentsMethods<Component<TType, TTag>>) {
23
- this.id = component.id;
24
- this.name = component.name;
25
- this.tag = component.tag;
26
- this.type = component.type;
27
- this.variant = component.variant;
28
- this.order = component.order;
29
- this.props = component.props;
30
- this.count = component.count;
31
- this.updatedAt = component.updatedAt;
32
- this.createdAt = component.createdAt;
33
- this.instanceId = component.instanceId;
34
- }
35
-
36
- isInstance(): boolean {
37
- return !!this.instanceId;
38
- }
39
-
40
- getChildren(_tree: CoraxTree): Set<BlockId> {
41
- //#TODO
42
- return new Set();
43
- }
44
-
45
- appendChild(tree: CoraxTree): CoraxTree {
46
- return tree;
47
- }
48
-
49
- removeChild(tree: CoraxTree): CoraxTree {
50
- return tree;
51
- }
52
-
53
- getCurrentComponentObject(): OmitComponentsMethods<Component<TType, TTag>> {
54
- return {
55
- id: this.id,
56
- name: this.name,
57
- tag: this.tag,
58
- type: this.type,
59
- variant: this.variant,
60
- order: this.order,
61
- props: this.props,
62
- count: this.count,
63
- instanceId: this.instanceId,
64
- createdAt: this.createdAt,
65
- updatedAt: this.updatedAt,
66
- };
67
- }
68
- }
@@ -1,57 +0,0 @@
1
- import type {
2
- Container,
3
- ContainerId,
4
- ContainerProps,
5
- ContainerTag,
6
- ContainerType,
7
- } from "../types/container/container.ts";
8
- import type { OmitContainersMethods } from "../types/global.types.ts";
9
- import type { BlockId, CoraxTree } from "../types/tree/tree.ts";
10
-
11
- export class ContainerClass<
12
- TType extends ContainerType = ContainerType,
13
- TTag extends ContainerTag = ContainerTag,
14
- > implements Container<TType, TTag> {
15
- id: ContainerId;
16
- name: string;
17
- tag: TTag;
18
- type: TType;
19
- props: ContainerProps<TTag>;
20
- variant = "container" as const;
21
- order: Set<BlockId>;
22
-
23
- constructor(container: OmitContainersMethods<Container<TType, TTag>>) {
24
- this.id = container.id;
25
- this.name = container.name;
26
- this.tag = container.tag;
27
- this.type = container.type;
28
- this.variant = container.variant;
29
- this.order = container.order;
30
- this.props = container.props;
31
- }
32
-
33
- getChildren(_tree: CoraxTree): Set<BlockId> {
34
- //#TODO
35
- return new Set();
36
- }
37
-
38
- appendChild(tree: CoraxTree): CoraxTree {
39
- return tree;
40
- }
41
-
42
- removeChild(tree: CoraxTree): CoraxTree {
43
- return tree;
44
- }
45
-
46
- getCurrentContainerObject(): OmitContainersMethods<Container<TType, TTag>> {
47
- return {
48
- id: this.id,
49
- name: this.name,
50
- tag: this.tag,
51
- type: this.type,
52
- variant: this.variant,
53
- order: this.order,
54
- props: this.props,
55
- };
56
- }
57
- }
@@ -1,42 +0,0 @@
1
- import type { Field, FieldId, FieldProps, FieldTag, FieldType } from "../types/field/field.ts";
2
- import type { ContainerId } from "../types/container/container.ts";
3
- import type { OmitFieldsMethods } from "../types/global.types.ts";
4
-
5
- export class FieldClass<
6
- TType extends FieldType = FieldType,
7
- TTag extends FieldTag = FieldTag,
8
- > implements Field<TType, TTag> {
9
- id: FieldId;
10
- name: string;
11
- tag: TTag;
12
- type: TType;
13
- variant = "field" as const;
14
- containerId?: ContainerId;
15
- props: FieldProps<TTag>;
16
-
17
- constructor(field: OmitFieldsMethods<Field<TType, TTag>>) {
18
- this.id = field.id;
19
- this.name = field.name;
20
- this.tag = field.tag;
21
- this.containerId = field.containerId;
22
- this.props = field.props;
23
- this.variant = field.variant;
24
- this.type = field.type;
25
- }
26
-
27
- isContainerized(): boolean {
28
- return !!this.containerId;
29
- }
30
-
31
- getCurrentFieldObject(): OmitFieldsMethods<Field<TType, TTag>> {
32
- return {
33
- id: this.id,
34
- name: this.name,
35
- tag: this.tag,
36
- containerId: this.containerId,
37
- props: this.props,
38
- variant: this.variant,
39
- type: this.type,
40
- };
41
- }
42
- }
@@ -1,38 +0,0 @@
1
- import type { TNode, TNodeId, TNodeProps, TNodeTag, TNodeType } from "../types/node/node.ts";
2
- import type { OmitTNodesMethods } from "../types/global.types.ts";
3
- import type { FieldId } from "../types/field/field.ts";
4
-
5
- export class TNodeClass<
6
- T extends TNodeType = TNodeType,
7
- A extends TNodeTag = TNodeTag,
8
- > implements TNode<T, A> {
9
- id: TNodeId;
10
- tag: A;
11
- type: T;
12
- name: string;
13
- variant: "tnode";
14
- fieldId?: FieldId;
15
- props: TNodeProps<A>;
16
-
17
- constructor(tnode: OmitTNodesMethods<TNode<T, A>>) {
18
- this.id = tnode.id;
19
- this.name = tnode.name;
20
- this.variant = tnode.variant;
21
- this.tag = tnode.tag;
22
- this.props = tnode.props;
23
- this.type = tnode.type;
24
- this.fieldId = tnode.fieldId;
25
- }
26
-
27
- getCurrentNodeObject(): OmitTNodesMethods<TNode<T, A>> {
28
- return {
29
- id: this.id,
30
- name: this.name,
31
- variant: this.variant,
32
- tag: this.tag,
33
- type: this.type,
34
- props: this.props,
35
- fieldId: this.fieldId,
36
- };
37
- }
38
- }
@@ -1,21 +0,0 @@
1
- import type { Container, ContainerTag, ContainerType } from "../container/container.ts";
2
- import type { OmitComponentsMethods } from "../global.types.ts";
3
-
4
- export type ComponentId =
5
- | `component:${string}-${string}-${string}-${string}-${string}`
6
- | `component:${string}`;
7
-
8
- export interface Component<
9
- T extends ContainerType = ContainerType,
10
- A extends ContainerTag = ContainerTag,
11
- > extends Omit<Container<T, A>, "getCurrentContainerObject" | "variant" | "id"> {
12
- id: ComponentId;
13
- count: number;
14
- updatedAt: number;
15
- createdAt: number;
16
- variant: "component";
17
- instanceId?: ComponentId;
18
-
19
- getCurrentComponentObject(): OmitComponentsMethods<Component<T, A>>;
20
- isInstance(): boolean;
21
- }
@@ -1,37 +0,0 @@
1
- import type { UlListProps } from "./ul-list.types.ts";
2
- import type { SectionProps } from "./section.types.ts";
3
- import type { BlockId, CoraxTree } from "../tree/tree.ts";
4
- import type { OmitContainersMethods } from "../global.types.ts";
5
- import type { DivisionProps } from "./division.types.ts";
6
-
7
- export type ContainerType = "list" | "section" | "division";
8
- export type ContainerTag = "ul" | "section" | "div";
9
- export type ContainerId =
10
- | `container:${string}-${string}-${string}-${string}-${string}`
11
- | `container:${string}`;
12
-
13
- export type ContainerGlobalProps = {
14
- ul: UlListProps;
15
- section: SectionProps;
16
- div: DivisionProps;
17
- };
18
-
19
- export type ContainerProps<A extends ContainerTag = ContainerTag> = ContainerGlobalProps[A];
20
-
21
- export interface Container<
22
- T extends ContainerType = ContainerType,
23
- A extends ContainerTag = ContainerTag,
24
- > {
25
- id: ContainerId;
26
- tag: A;
27
- type: T;
28
- name: string;
29
- props: ContainerProps<A>;
30
- variant: "container";
31
- order: Set<BlockId>;
32
-
33
- getChildren(tree: CoraxTree): Set<BlockId>;
34
- removeChild(tree: CoraxTree): CoraxTree;
35
- appendChild(tree: CoraxTree): CoraxTree;
36
- getCurrentContainerObject(): OmitContainersMethods<Container<T, A>>;
37
- }
@@ -1,3 +0,0 @@
1
- import type { NodeCommonProps } from "../global.types";
2
-
3
- export interface DivisionProps extends NodeCommonProps {}
@@ -1,33 +0,0 @@
1
- import type * as CSS from "csstype";
2
-
3
- export type CoraxCSSProperties = CSS.PropertiesFallback<number | string>;
4
- export type CoraxCSSPropertiesWithMultiValues = {
5
- [K in keyof CoraxCSSProperties]:
6
- | CoraxCSSProperties[K]
7
- | ReadonlyArray<Extract<CoraxCSSProperties[K], string>>;
8
- };
9
- export type CoraxCSSPseudos = {
10
- [K in CSS.Pseudos]?: CoraxCSSObject;
11
- };
12
- export interface ArrayCSSInterpolation extends ReadonlyArray<CoraxCSSInterpolation> {}
13
- export type CoraxInterpolationPrimitive =
14
- | null
15
- | undefined
16
- | boolean
17
- | number
18
- | string
19
- | CoraxKeyframes
20
- | CoraxCSSObject;
21
- export type CoraxCSSInterpolation = CoraxInterpolationPrimitive | ArrayCSSInterpolation;
22
- export interface CoraxCSSOthersObject {
23
- [propertiesName: string]: CoraxCSSInterpolation;
24
- }
25
- export interface CoraxCSSObject
26
- extends CoraxCSSPropertiesWithMultiValues, CoraxCSSPseudos, CoraxCSSOthersObject {}
27
-
28
- export type CoraxKeyframes = {
29
- name: string;
30
- styles: string;
31
- anim: number;
32
- toString: () => string;
33
- } & string;
@@ -1,3 +0,0 @@
1
- import type { NodeCommonProps } from "../global.types";
2
-
3
- export interface DividerProps extends NodeCommonProps {}
@@ -1,46 +0,0 @@
1
- import type { ParagraphProps } from "./paragraph.types.ts";
2
- import type { HeadingProps } from "./heading.types.ts";
3
- import type { ContainerId } from "../container/container.ts";
4
- import type { OmitFieldsMethods } from "../global.types.ts";
5
- import type { MediaCommonProps } from "./field.media.types";
6
- import type { DividerProps } from "./divider.types";
7
-
8
- export type FieldType = keyof FieldTMap;
9
- export type FieldTag = keyof FieldMap;
10
- export type FieldId = `field:${string}-${string}-${string}-${string}-${string}` | `field:${string}`;
11
-
12
- export interface FieldMap {
13
- p: ParagraphProps;
14
- h1: HeadingProps;
15
- img: MediaCommonProps;
16
- video: MediaCommonProps;
17
- hr: DividerProps;
18
- }
19
-
20
- export interface FieldTMap {
21
- text: {};
22
- heading: {};
23
- image: {};
24
- video: {};
25
- divider: {};
26
- }
27
-
28
- export type FieldPropsByTag<T extends FieldTag = FieldTag> = FieldMap[T];
29
- export type FieldProps<A extends FieldTag = FieldTag> = FieldPropsByTag<A>;
30
-
31
- export interface Field<T extends FieldType = FieldType, A extends FieldTag = FieldTag> {
32
- id: FieldId;
33
- tag: A;
34
- type: T;
35
- name: string;
36
- variant: "field";
37
- containerId?: ContainerId;
38
- props: FieldProps<A>;
39
-
40
- isContainerized(): boolean;
41
- getCurrentFieldObject(): OmitFieldsMethods<Field<T, A>>;
42
- }
43
-
44
- export type TextField = Field<"heading" | "text", "h1" | "p">;
45
- export type MediaField = Field<"image" | "video", "img" | "video">;
46
- export type DividerField = Field<"divider", "hr">;